Leak found running drm-formats-test with ASan:
==58755==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
#2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
#3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
#4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
#5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
#2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
#3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
#4 0x55723c67deca in subtract_arrays_modifier_invalid ../tests/drm-formats-test.c:613
#5 0x55723c67da3d in wrapsubtract_arrays_modifier_invalid ../tests/drm-formats-test.c:593
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
#2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
#3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
#4 0x55723c67c9c0 in subtract_arrays_same_content ../tests/drm-formats-test.c:521
#5 0x55723c67c55b in wrapsubtract_arrays_same_content ../tests/drm-formats-test.c:504
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
#2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
#3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
#4 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
#5 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7fae744dbe3a in zalloc ../include/libweston/zalloc.h:38
#2 0x7fae744dbe4e in weston_drm_format_array_create ../libweston/drm-formats.c:44
#3 0x7fae744dd2a2 in weston_drm_format_array_subtract ../libweston/drm-formats.c:410
#4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
#5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 320 byte(s) in 5 object(s) allocated from:
#0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
#2 0x7fae74473c10 in wl_array_copy (/usr/lib/libwayland-client.so.0+0xac10)
#3 0x7fae744dbfe0 in add_format_and_modifiers ../libweston/drm-formats.c:108
#4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
#5 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
#6 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
#7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#13 0x55723c680844 in main ../tests/weston-test-runner.c:661
#14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 256 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
#2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
#3 0x7fae744dbfb7 in add_format_and_modifiers ../libweston/drm-formats.c:104
#4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
#5 0x55723c67d1b7 in subtract_arrays_exclusive_formats ../tests/drm-formats-test.c:552
#6 0x55723c67cb23 in wrapsubtract_arrays_exclusive_formats ../tests/drm-formats-test.c:529
#7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#13 0x55723c680844 in main ../tests/weston-test-runner.c:661
#14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 256 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
#2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
#3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
#4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
#5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 128 byte(s) in 2 object(s) allocated from:
#0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
#2 0x7fae74473c10 in wl_array_copy (/usr/lib/libwayland-client.so.0+0xac10)
#3 0x7fae744dbfe0 in add_format_and_modifiers ../libweston/drm-formats.c:108
#4 0x7fae744dd389 in weston_drm_format_array_subtract ../libweston/drm-formats.c:418
#5 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
#6 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
#7 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#8 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#9 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#10 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#11 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#12 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#13 0x55723c680844 in main ../tests/weston-test-runner.c:661
#14 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#15 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 96 byte(s) in 3 object(s) allocated from:
#0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
#2 0x7fae744dd142 in modifiers_subtract ../libweston/drm-formats.c:384
#3 0x7fae744dd408 in weston_drm_format_array_subtract ../libweston/drm-formats.c:431
#4 0x55723c67bed5 in subtract_arrays ../tests/drm-formats-test.c:487
#5 0x55723c67b6bb in wrapsubtract_arrays ../tests/drm-formats-test.c:467
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 64 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
#1 0x7fae74473b76 in wl_array_add (/usr/lib/libwayland-client.so.0+0xab76)
#2 0x7fae744dd142 in modifiers_subtract ../libweston/drm-formats.c:384
#3 0x7fae744dd408 in weston_drm_format_array_subtract ../libweston/drm-formats.c:431
#4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
#5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
#2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
#3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
#4 0x55723c67d8d5 in subtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:584
#5 0x55723c67d31d in wrapsubtract_arrays_exclusive_modifiers ../tests/drm-formats-test.c:561
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
#2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
#3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
#4 0x55723c67deca in subtract_arrays_modifier_invalid ../tests/drm-formats-test.c:613
#5 0x55723c67da3d in wrapsubtract_arrays_modifier_invalid ../tests/drm-formats-test.c:593
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Indirect leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7fae74658279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fae74473bc3 in wl_array_add (/usr/lib/libwayland-client.so.0+0xabc3)
#2 0x7fae744dc19f in weston_drm_format_array_add_format ../libweston/drm-formats.c:166
#3 0x7fae744dd3de in weston_drm_format_array_subtract ../libweston/drm-formats.c:426
#4 0x55723c67c9c0 in subtract_arrays_same_content ../tests/drm-formats-test.c:521
#5 0x55723c67c55b in wrapsubtract_arrays_same_content ../tests/drm-formats-test.c:504
#6 0x55723c67e9a9 in run_test ../tests/weston-test-runner.c:162
#7 0x55723c67f0af in run_case ../tests/weston-test-runner.c:277
#8 0x55723c67ee48 in for_each_test_case ../tests/weston-test-runner.c:235
#9 0x55723c67f358 in testsuite_run ../tests/weston-test-runner.c:311
#10 0x55723c680381 in weston_test_harness_execute_standalone ../tests/weston-test-runner.c:572
#11 0x55723c6803b1 in fixture_setup_run_ ../tests/weston-test-runner.c:610
#12 0x55723c680844 in main ../tests/weston-test-runner.c:661
#13 0x7fae742c4b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
#14 0x55723c67442d in _start (/home/lele/weston/build/tests/test-drm-formats+0x642d)
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The DRM backend uses changes in the cursor view memory address and
surface damage to detect when it needs to re-upload to a cursor plane
framebuffer.
However, when a cursor view is destroyed and then recreated, e.g., when
the pointer cursor surface is updated, the newly created view may have
the same memory address as the just destroyed one. If no new cursor
buffer is provided (because it was attached, committed and used
previously) when this address reuse occurs, then there also isn't any
updated surface damage and the backend doesn't update the cursor plane
framebuffer at all.
To fix this issue utilize the destroy signal to track when the cursor
view is destroyed, and clear the cached cursor_view value in drm_output.
After clearing the cached value, the next cursor view is always
considered new and thus uploaded to the plane properly.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
This creates the FP16 shadow framebuffer automatically if the color
transformation from blending space to output space is not identity and
the backend does not claim to implement it on the renderer's behalf.
That makes the weston_output_set_renderer_shadow_buffer() API and
use-renderer-shadow weston.ini option obsolete.
To still cater for the one test that needs to enable the shadow
framebuffer in spite of not needing it for color correct blending, the
quirk it uses now also forces the shadow.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Compile time constants play an important role in keeping the shader
programs fast. Introduce an informal annotation to mark compile time
constants to make the shader code easier to reason with.
This will make much more sense once functions with compile time constant
parameters are added.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Trying to support GL ES 2.0 + extensions along with GL ES 3.0 for better
control is becoming too complicated fast. In this patch you see the
GL_RGBA vs. GL_RBA16F and GL_HALF_FLOAT vs. GL_HALF_FLOAT_OES paths.
More such cases will come, e.g. GL_RED_EXT vs. GL_R32F.
Make things simpler and require GL ES 3.0 +
GL_EXT_color_buffer_half_float for all color management related
functionality. If one doesn't have GL ES 3.0, all you lose is color
management.
Also, all extensions needed by color transformation operations are
gathered under one boolean flag instead of having a flag per extension,
again for simplicity.
This makes the GL ES extension handling much easier.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This reverts commit 36d699a164.
A different way to fix this same issue is the previous commit
"gl-renderer: do not unbind the context on output destroy"
which is needed for other reasons.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
If we make EGL_NO_CONTEXT current, all following GL calls are
no-ops. This will be a problem when gl-renderer introduces
gl_renderer_color_transform containing GL textures and needs to destroy
them when weston_color_transform is destroyed. Mesa would print the the
warning that glDeleteTextures is no-op.
To fix this, keep our GL context current when destroying a GL output.
In case EGL_KHR_surfaceless_context is not available, we must use
dummy_surface.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This creates the color-lcms plugin that in the future will be using
Little CMS as the color matching module, processing ICC profiles, and
producing HDR tone mappings.
Right now, this new plugin is functionally equivalent to the no-op color
manager, except it already links to lcms2 and checks that the renderer
supports color operations.
Color-lcms is a libweston plugin that is loaded with explicit
weston_compositor API. This does not currently allow loading alternative
color manager plugins. External color manager plugins might be
considered in the future when the libweston APIs around color management
stabilize.
This libweston plugin uses the same build option as the old cms-static
Weston plugins, as they both need lcms2. The minimum version for lcms2
was chosen by what Debian Buster provides today and for no other reason.
This plugin intends to support the Wayland CM&HDR protocol extension and
hence sets supports_client_protocol to true. This will expose the
protocol extension to clients when it gets implemented.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is needed when the compositor produces any content internally:
- the lines in triangle fan debug
- the censoring color fill (unmet HDCP requirements)
Solid color surfaces do not need this special-casing because
weston_surface is supposed to carry color space information, which will
get used in gl_shader_config_init_for_view().
This makes sure the internally produced graphics fit in, e.g on a
monitor in HDR mode.
For now, just ensure there is an identity transformation. Actual
implementations in GL-renderer will follow later.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is needed when drawing anything internal directly to an output,
like the borders/decorations in a nested compositor setup. This makes
the assumption that the internal stuff starts in sRGB, which should be
safe. As borders are never blended with other content, this should also
be sufficient.
This patch is a reminder that that path exists, rather than a real
implementation. To be implemented when someone needs it.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This is the blending space to monitor space color transform. It needs to
be implemented in the renderers, unless a backend sets
from_blend_to_output_by_backend = true, in which case the backend does
it and the renderer does not.
The intention is that from_blend_to_output_by_backend can be toggled
frame by frame to allow backends to react to dynamic change of output
color profile.
For now, renderers just assert that they don't need to do anything for
output color transform.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
See: https://gitlab.freedesktop.org/wayland/weston/-/issues/467#note_814985
This starts building the framework required for implementing color
management.
The main new interface is struct weston_color_manager. This commit also
adds a no-op color manager implementation, which is used if no other
color manager is loaded. This no-op color manager simply provides
identity color transforms for everything, so that Weston keeps running
exactly like before.
weston_color_manager interface is incomplete and will be extended later.
Colorspace objects are not introduced in this commit. However, when
client content colorspace and output colorspace definitions are
combined, they will produce color transformations from client content to
output blending space and from output blending space to output space.
This commit introduces a placeholder struct for color transforms,
weston_color_transform. Objects of this type are expected to be heavy to
create and store, which is why they are designed to be shared as much as
possible, ideally making their instances unique. As color transform
description is intended to be generic in libweston core, renderers and
backends are expected to derive their own state for each transform
object as necessary. Creating and storing the derived state maybe be
expensive as well, more the reason to re-use these objects as much as
possible. E.g. GL-renderer might upload a 3D LUT into a texture and keep
the texture around. DRM-backend might create a KMS blob for a LUT and
keep that around.
As a color transform depends on both the surface and the output, a
transform object may need to be created for each unique pair of them.
Therefore color transforms are referenced from weston_paint_node. As
paint nodes exist for not just surface+output but surface+view+output
triplets, the code ensures that all paint nodes (having different view)
for the same surface+output have the same color transform state.
As a special case, if weston_color_transform is NULL, it means identity
transform. This short-circuits some checks and memory allocations, but
it does mean we use a separate member on weston_paint_node to know if
the color transform has been initialized or not.
Color transformations are pre-created at the weston_output
paint_node_z_order_list creation step. Currently the z order lists
contain all views globally, which means we populate color transforms we
may never need, e.g. a view is never shown on a particular output.
This problem should get fixed naturally when z order lists are
constructed "pruned" in the future: to contain only those paint nodes
that actually contribute to the output's image.
As nothing actually supports color transforms yet, both renderers and
the DRM-backend assert that they only get identity transforms. This
check has the side-effect that all surface-output pairs actually get a
weston_surface_color_transform_ref even though it points to NULL
weston_color_transform.
This design is inspired by Sebastian Wick's Weston color management
work.
Co-authored-by: Sebastian Wick <sebastian@sebastianwick.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
A following patch will need the paint node in
gl_shader_config_init_for_view() for color transformations.
While passing the paint node through, rename the functions to be more
appropriate and get surface/view/output from the paint node.
This is a pure refactoring with no functional change.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
A following patch will need the paint node in draw_view() for color
transformations.
While passing the paint node into draw_paint_node, also use the paint
node. This is a pure refactoring with no functional change.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
When setting a cursor surface, use the surface dimensions, instead of the
weston_surface buffer reference, to check if the surface has any
content. A weston_surface without any buffer reference may in fact
have a buffer which was committed in a previous pointer entry, dropped
by weston_surface and now held only internally by the renderer.
Without this fix, when a pointer enters a surface, the cursor image is
not correctly updated if we set a cursor surface with an already
committed buffer from a previous pointer entry, without recommitting the
cursor buffer for the current entry. This can be seen, for example, in
the experimental Wine Wayland driver which handles the cursor in a way
that leads to the following scenario:
Setup: cursor_surface.attach(buffer) & cursor_surface.commit()
On first wl_pointer.enter: pointer.set_cursor(cursor_surface)
compositor/renderer redraws
wl_pointer.leave
On second wl_pointer.enter: pointer.set_cursor(cursor_surface)
When handling the second pointer.set_cursor() request the current code
doesn't find a buffer attached to the cursor_surface (only the renderer
now has a reference to it), so it doesn't update the respective view for
the cursor.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Remove all the backend code to support drivers without universal planes.
From[1]:
"The code needed to support kernels where DRM does not support uiniversal
planes makes the DRM-backend a little more complicated, because it needs
to create fake planes for primary and cursor. The lifetimes of the fake
planes does not match the lifetime of "proper" planes, which is surprising."
And since the universal planes left the experimetal flag in 2014[2] it is
safe to remove the support now.
[1] https://gitlab.freedesktop.org/wayland/weston/-/issues/427
[2] https://cgit.freedesktop.org/drm/drm-tip/commit/?id=c7dbc6c9ae5c3baa3be755a228a349374d043b5b
Signed-off-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
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 <samu.nuutamo@gmail.com>
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 <luwang@nvidia.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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 <pekka.paalanen@collabora.com>
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
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/582#note_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 <pekka.paalanen@collabora.com>
Use the real name of the seat instead of calling each seat 'default'. This makes
it easier to identify the current seat in a multi-seat environment.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This change fixes the "touch-up" operation to clear "data_source"
by setting "seat" to NULL. This operation is done in the mouse button
release operation, but seems to have been forgotten in the "touch up"
case.
Forgetting this operation causes weston to send a "premature finish
request" error to the client which causes the client to exit.
This issue can be reproduced with the "weston-dnd" program by performing
a drag-and-drop operation with a touch input device. Once the drag
is released, the weston-dnd program will exit with an error.
Signed-off-by: Jonathan Marler <johnnymarler@gmail.com>
If sprites_are_broken, then we will only ever arrive in renderer_only
mode, so this case will be caught by the checks above.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Avoids an user-after-free when destroying the surface, like in the
following ASAN message:
==25180==ERROR: AddressSanitizer: heap-use-after-free on address 0x6060000589d8 at pc 0x7ff70a4f7102 bp 0x7fff8f7e13b0 sp 0x7fff8f7e13a8
READ of size 8 at 0x6060000589d8 thread T0
#0 0x7ff70a4f7101 in weston_schedule_surface_protection_update ../libweston/compositor.c:1163
#1 0x7ff70a4f743b in weston_surface_update_output_mask ../libweston/compositor.c:1212
#2 0x7ff70a4f7a47 in weston_surface_assign_output ../libweston/compositor.c:1298
#3 0x7ff70a4f7f44 in weston_view_assign_output ../libweston/compositor.c:1348
#4 0x7ff70a4fa12f in weston_view_update_transform ../libweston/compositor.c:1589
#5 0x7ff70a4ffc20 in view_list_add ../libweston/compositor.c:2657
#6 0x7ff70a5000ee in weston_compositor_build_view_list ../libweston/compositor.c:2688
#7 0x7ff70a4fd577 in weston_view_destroy ../libweston/compositor.c:2202
#8 0x7ff70a4fd7df in weston_surface_destroy ../libweston/compositor.c:2239
#9 0x7ff70a4fdbb0 in destroy_surface ../libweston/compositor.c:2285
#10 0x7ff70a4a2d3e in destroy_resource ../src/wayland-server.c:723
#11 0x7ff70a4a8940 in for_each_helper ../src/wayland-util.c:372
#12 0x7ff70a4a8e1f in wl_map_for_each ../src/wayland-util.c:385
#13 0x7ff70a4a3748 in wl_client_destroy ../src/wayland-server.c:882
#14 0x7ff6fe04e866 in shell_destroy ../desktop-shell/shell.c:5004
#15 0x7ff70a4ee923 in wl_signal_emit /home/mvlad/install-amd64/include/wayland-server-core.h:481
#16 0x7ff70a51598d in weston_compositor_destroy ../libweston/compositor.c:7903
#17 0x7ff70a903a58 in wet_main ../compositor/main.c:3493
#18 0x560de7b3b179 in main ../compositor/executable.c:33
#19 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308
#20 0x560de7b3b099 in _start (/home/mvlad/install-amd64/bin/weston+0x1099)
0x6060000589d8 is located 56 bytes inside of 64-byte region [0x6060000589a0,0x6060000589e0)
freed by thread T0 here:
#0 0x7ff70a9d3b6f in __interceptor_free (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xa9b6f)
#1 0x7ff70a5167d2 in cp_destroy_listener ../libweston/content-protection.c:193
#2 0x7ff70a4ee923 in wl_signal_emit /home/mvlad/install-amd64/include/wayland-server-core.h:481
#3 0x7ff70a51598d in weston_compositor_destroy ../libweston/compositor.c:7903
#4 0x7ff70a903a58 in wet_main ../compositor/main.c:3493
#5 0x560de7b3b179 in main ../compositor/executable.c:33
#6 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308
previously allocated by thread T0 here:
#0 0x7ff70a9d4037 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xaa037)
#1 0x7ff70a5160aa in zalloc ../include/libweston/zalloc.h:38
#2 0x7ff70a516cda in weston_compositor_enable_content_protection ../libweston/content-protection.c:329
#3 0x7ff7070247e0 in drm_backend_create ../libweston/backend-drm/drm.c:3180
#4 0x7ff707024cae in weston_backend_init ../libweston/backend-drm/drm.c:3250
#5 0x7ff70a515d02 in weston_compositor_load_backend ../libweston/compositor.c:7999
#6 0x7ff70a8fbcfb in load_drm_backend ../compositor/main.c:2614
#7 0x7ff70a900b46 in load_backend ../compositor/main.c:3103
#8 0x7ff70a902ecd in wet_main ../compositor/main.c:3380
#9 0x560de7b3b179 in main ../compositor/executable.c:33
#10 0x7ff70a73ecc9 in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: heap-use-after-free ../libweston/compositor.c:1163 in weston_schedule_surface_protection_update
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Weston internals and Wayland clients assume that output presentation
clock cannot go backwards. Therefore require unconditionally that KMS
uses the monotonic clock.
The kernel unconditionally supports DRM_CAP_TIMESTAMP_MONOTONIC. See:
commit 25e1a79874eb3821d93310c908cc0a81b47af060
Author: Arnd Bergmann <arnd@arndb.de>
Date: Wed Oct 11 17:20:13 2017 +0200
drm: vblank: remove drm_timestamp_monotonic parameter
That one removed the final possibility of DRM_CAP_TIMESTAMP_MONOTONIC
being false, by removing the module option. But even before that, all
drivers have been supporting monotonic, since
commit c61eef726a78ae77b6ce223d01ea2130f465fe5c
Author: Imre Deak <imre.deak@intel.com>
Date: Tue Oct 23 18:53:26 2012 +0000
drm: add support for monotonic vblank timestamps
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This drops the software presentation clocks that could jump backwards.
See the previous commit "libweston: assert frame times never go
backwards" for the rationale.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Adding this check was prompted by
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/609
There is no reason to allow frame times jump backwards, and apparently
we already have code that makes that assumption.
DRM KMS uses CLOCK_MONOTONIC as the vblank and page flip timestamps,
which by definition cannot go backwards. Other backends call
weston_compositor_set_presentation_clock_software().
Frame times are also reported directly to Wayland clients via
presentation-time extension, and clients too will not expect that the
timestamp could go backwards.
So make sure time can never go backwards.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
As observed in #420 (Running Weston under Weston's kiosk shell with
multiple outputs causes the scrollback to go nuts), not
being able to cope with (a correct) resize of the parent surface would
cause the client weston instance to spin forever. If dispatching
failed, just exit.
Fixes#420
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
As an in-flight resize call might cause a call to
wayland_output_destroy_shm_buffers() to go over a list of free_buffers
list. Just initialize the lists before attempting to create the parent
surface to avoid it.
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
fb->format is *pixel_format_info, whereas fb->format->format is the
actual DRM/wl_shm format code we want to see here. Fix the drm_debug()
call accordingly.
Signed-off-by: Bastian Krause <bst@pengutronix.de>
In "backend-drm: simplify compile time array copy", ARRAY_COPY was
introduced to be used by the DRM-backend.
In this patch we expand its usage to other code where hardcoded arrays
are being copied.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In drm_fb_get_from_dmabuf() we have some compile time array copies, and
multiple static_assert() calls are needed (for safety). This makes the
code unpleasant to read.
Add ARRAY_COPY macro, to simplify the code.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
EGL implementations have no way to tell that implicit modifiers are not
supported. So Weston must consider that implicit modifiers are
supported. Always add DRM_FORMAT_MOD_INVALID to formats that we query
from EGL.
The implication is that clients using dmabuf extension may pick
DRM_FORMAT_MOD_INVALID to allocate their buffers, and so these buffers
will not be directly imported to KMS and placed in planes. See commit
"backend-drm: do not import dmabuf buffers with no modifiers to KMS" for
more details.
But we should not avoid advertising DRM_FORMAT_MOD_INVALID in the dmabuf
protocol just because we hope that the client don't choose it, it's not
our choice.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In commit "libweston: add struct weston_drm_format" struct
weston_drm_format and its helper functions were added to libweston.
The functions query_dmabuf_formats and query_dmabuf_modifiers are very
specific to GL-renderer and its internals. So instead of exposing them
in libweston, query and store DRM formats and modifiers internally in
GL-renderer. Also, add a vfunction to struct weston_renderer in order
to retrieve the formats.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In commit "backend-drm: do not import dmabuf buffers with no modifiers
to KMS" we've stopped to import dmabuf with no modifiers to KMS.
In this patch we document why we can still import wl_drm buffers with no
modifiers to KMS.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
We can't tell the layout of a buffer that has been allocated with no
modifiers. Although usually drivers use linear layouts to allocate in
these cases, it is not a rule. It can use a tiling layout, for instance,
under the hood.
So it is not safe to import a buffer with no modifiers to KMS, as it
can't tell the buffer layout and this may result in garbage being
displayed. In this patch we start to require explicit modifiers to
import buffers to KMS.
In most cases things just work as expected, but just because both sides
(display and render driver) usually end up using the linear layout when
modifiers are not exposed. It also works on systems where the display
and render devices are tied (desktops with Intel or AMD, for instance),
as there's only one driver and it knows the layout of the buffer (no
need to guess).
But in SoC's where the display and render device are split, things can
go wrong. It is better to lose performance and not break things. To
solve the problem, drivers should be updated to expose modifiers (even
if only DRM_FORMAT_MOD_LINEAR), as the concept of implicit modifiers is
the root of the problem.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In commit "backend-drm: add DRM_FORMAT_MOD_INVALID to modifier sets when
no modifiers are supported" we've changed the code that iterates through
the IN_FORMATS blob property. Now it adds DRM_FORMAT_MOD_INVALID for
formats exposed without modifiers.
But the thing is that there shouldn't be formats in the IN_FORMATS blob
exposed without modifiers, as the blob has been added after the
introduction of the explicit modifiers API in the kernel. For now,
there's nothing in the kernel to ensure this correct behavior. So
instead of adding DRM_FORMAT_MOD_INVALID in this case, ignore these
formats, as userspace can't do much in this case.
In the future this may be fixed by the kernel. Or maybe the following MR
in libdrm, which adds an iterator API for the IN_FORMATS blob:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
From now on, when we can't know the modifiers supported for a certain
format, we add DRM_FORMAT_MOD_INVALID to its modifier set.
There is some parts where nothing is being added an others where
DRM_FORMAT_MOD_LINEAR is being added, so fix them.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
In create_gbm_surface() we may allocate with no modifiers in the
following situations:
1. old GBM version, so HAVE_GBM_MODIFIERS is false;
2. the KMS driver does not support modifiers;
3. if allocating with modifiers failed, what can happen when the KMS
display device supports modifiers but the GBM driver does not, e.g.
the old i915 Mesa driver.
The comment was only stating the third situation, so add the other two.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
The function drm_output_init_egl() is too big, so move the code to
create the gbm surface to a separate function: create_gbm_surface().
Also made some minor style changes to the code that has been moved, in
order to improve readability.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>