From 1cb81e57d06d6e82112c42764070deb81e134915 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 3 Nov 2022 15:50:49 +0900 Subject: [PATCH 01/16] Fix invalid assignment with pointer key of traceAsyncBegin and traceAsyncEnd is int type Change-Id: If89886350f370a62bfb6123cff3e1f0120f25e3a --- src/tdm_capture.c | 8 ++++---- src/tdm_layer.c | 6 +++--- src/tdm_pp.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tdm_capture.c b/src/tdm_capture.c index 5054136..d50e9c1 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -130,7 +130,7 @@ _tdm_capture_thread_cb_done(tdm_private_display *private_display, void *object, if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(buffer, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } if (!LIST_IS_EMPTY(&private_capture->buffer_list)) { @@ -447,7 +447,7 @@ tdm_capture_destroy_internal(tdm_private_capture *private_capture) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(b->buffer, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->buffer); @@ -472,7 +472,7 @@ tdm_capture_destroy_internal(tdm_private_capture *private_capture) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(b->buffer, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->buffer); @@ -643,7 +643,7 @@ tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(buffer, 0); - TDM_TRACE_ASYNC_BEGIN((intptr_t)capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((int)capture, "[CAPTURE] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); diff --git a/src/tdm_layer.c b/src/tdm_layer.c index b6f07f0..d7c20e6 100644 --- a/src/tdm_layer.c +++ b/src/tdm_layer.c @@ -536,7 +536,7 @@ tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h bu if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } tbm_surface_internal_unref(private_layer->pending_buffer); @@ -554,7 +554,7 @@ tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h bu if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0); - TDM_TRACE_ASYNC_BEGIN((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } return TDM_ERROR_NONE; @@ -648,7 +648,7 @@ tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer * if (private_layer->showing_buffer) { if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->showing_buffer->buffer, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } tdm_layer_free_buffer(private_layer, private_layer->showing_buffer); diff --git a/src/tdm_pp.c b/src/tdm_pp.c index ea3f5f0..f0d249d 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -147,7 +147,7 @@ _tdm_pp_thread_cb_done(tdm_private_display *private_display, void *object, tdm_t if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(dst, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); @@ -376,7 +376,7 @@ tdm_pp_destroy_internal(tdm_private_pp *private_pp) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(b->dst, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->src); @@ -402,7 +402,7 @@ tdm_pp_destroy_internal(tdm_private_pp *private_pp) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(b->dst, 0); - TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->src); @@ -579,7 +579,7 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(dst, 0); - TDM_TRACE_ASYNC_BEGIN((intptr_t)pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((int)pp, "[PP] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); -- 2.7.4 From d8cdf316509907b438959e1dcd46bbcf36f45dbb Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 3 Nov 2022 16:14:31 +0900 Subject: [PATCH 02/16] Fix overflow accessing Change-Id: If83ac5bcfff383b1b634d44c3fc4ecc37515deb5 --- tools/tdm_test_client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/tdm_test_client.c b/tools/tdm_test_client.c index a3f9cb2..c989200 100644 --- a/tools/tdm_test_client.c +++ b/tools/tdm_test_client.c @@ -447,7 +447,10 @@ _voutput_output_handler(tdm_client_output *output, tdm_output_change_type type, if (type == TDM_OUTPUT_CHANGE_CONNECTION) { status = (tdm_output_conn_status)value.u32; - printf("output %s.\n", conn_str[value.u32]); + if (value.u32 < 3) + printf("output %s.\n", conn_str[value.u32]); + else + printf("output unkown.\n"); if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) { printf("client: disconnected, destroy voutput\n"); -- 2.7.4 From 1ebf475e62aeb60aa78abe52ebb8600aa714e9c0 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 7 Nov 2022 14:04:40 +0900 Subject: [PATCH 03/16] Fix multiplication with signed and unsigned Change-Id: Ic6cb0da10136186c09677f9f6fe4fd436dfac382 --- haltests/src/tc_tdm_layer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haltests/src/tc_tdm_layer.cpp b/haltests/src/tc_tdm_layer.cpp index 68045a1..34596e9 100644 --- a/haltests/src/tc_tdm_layer.cpp +++ b/haltests/src/tc_tdm_layer.cpp @@ -572,8 +572,8 @@ TEST_P(TDMLayer, LayerGetZpos) continue; EXPECT_TRUE(zpos >= 0); EXPECT_TRUE(pipe < (unsigned int)output_count); - EXPECT_TRUE(*(check_table + pipe * layer_count + zpos) == false); - *(check_table + pipe * layer_count + zpos) = true; + EXPECT_TRUE(*(check_table + pipe * (unsigned int)layer_count + (unsigned int)zpos) == false); + *(check_table + pipe * (unsigned int)layer_count + (unsigned int)zpos) = true; } free(check_table); -- 2.7.4 From 267c07924212a0f152b1ebc4775701cae7d62571 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 7 Nov 2022 14:06:07 +0900 Subject: [PATCH 04/16] Package version up to 3.1.4 Change-Id: Ibbf9b3bb0038140ba5c64aa4ff1ce59cf256d9d9 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 981f2a3..01fc06d 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 3.1.3 +Version: 3.1.4 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 18c786cd7156183f5ccae1676725a350943867cf Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Tue, 1 Nov 2022 09:30:39 +0900 Subject: [PATCH 05/16] Redefine 'tdm_transform' enumaration It was discovered that some tdm backend driver actually tnranslated 90 and 270 degree rotations of 'tdm_transform' enumeration as counter-clockwise. Since there is no other tdm backend drivers using 'tdm_transform' enumeration, we've decided to redefine `tdm_transform` enumeration rather than guide the tdm backend driver to follow the spec in the documentation. Change-Id: Ibea6ecd7e8ff38ac2312580507001ebbe826fb67 --- include/tdm_common.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/tdm_common.h b/include/tdm_common.h index a3ccede..48192ab 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -78,13 +78,13 @@ typedef enum { */ typedef enum { TDM_TRANSFORM_NORMAL = 0, /**< no transform */ - TDM_TRANSFORM_90 = 1, /**< rotate 90 degrees clockwise */ - TDM_TRANSFORM_180 = 2, /**< rotate 180 degrees clockwise */ - TDM_TRANSFORM_270 = 3, /**< rotate 270 degrees clockwise */ + TDM_TRANSFORM_90 = 1, /**< rotate 90 degrees counter-clockwise */ + TDM_TRANSFORM_180 = 2, /**< rotate 180 degrees counter-clockwise */ + TDM_TRANSFORM_270 = 3, /**< rotate 270 degrees counter-clockwise */ TDM_TRANSFORM_FLIPPED = 4, /**< no rotate and horizontal flip */ - TDM_TRANSFORM_FLIPPED_90 = 5, /**< rotate 90 degrees clockwise and horizontal flip */ - TDM_TRANSFORM_FLIPPED_180 = 6, /**< rotate 180 degrees clockwise and horizontal flip */ - TDM_TRANSFORM_FLIPPED_270 = 7, /**< rotate 270 degrees clockwise and horizontal flip */ + TDM_TRANSFORM_FLIPPED_90 = 5, /**< rotate 90 degrees counter-clockwise and horizontal flip */ + TDM_TRANSFORM_FLIPPED_180 = 6, /**< rotate 180 degrees counter-clockwise and horizontal flip */ + TDM_TRANSFORM_FLIPPED_270 = 7, /**< rotate 270 degrees counter-clockwise and horizontal flip */ } tdm_transform; /** -- 2.7.4 From cee9178c17116fce5a121dbcf59f3b9a909e196a Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 13 Apr 2023 21:35:59 +0900 Subject: [PATCH 06/16] tdm_vblank: add wait_info vaildation checking to sw vblank cb function check tdm_vblank_wait_info validation in thread cb before execute w->func. Change-Id: Iaca3cc907225ffa8de242064300e0aa26af5770b Signed-off-by: Junkyeong Kim --- src/tdm_vblank.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tdm_vblank.c b/src/tdm_vblank.c index 9526926..bc53543 100644 --- a/src/tdm_vblank.c +++ b/src/tdm_vblank.c @@ -1400,6 +1400,11 @@ _tdm_vblank_cb_vblank_SW(tdm_private_display *private_display, void *object, tdm if (w->target_time != first_wait_info->target_time) break; + if (!_tdm_vblank_check_valid_wait(w)) { + TDM_ERR("can't find wait(%p) from valid_wait_list", w); + break; + } + LIST_DEL(&w->link); _tdm_vblank_valid_list_del(&w->valid_link); -- 2.7.4 From f2efd9734163ab32540088664aafdc6becd76494 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 13 Apr 2023 21:41:24 +0900 Subject: [PATCH 07/16] Package version up to 3.1.5 Change-Id: Ia059fe2f90e427c5005cbc42d667769e966468f5 Signed-off-by: Junkyeong Kim --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 01fc06d..d292205 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 3.1.4 +Version: 3.1.5 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 16d662e83dfcc80ebd797f8c8324cfb234ce29da Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 14 Apr 2023 15:51:22 +0900 Subject: [PATCH 08/16] Revert "Fix invalid assignment with pointer" build failure occured to 64bit build. This reverts commit 1cb81e57d06d6e82112c42764070deb81e134915. Change-Id: I06bd7dc891f375d8fa6ffa177d1e02ff41861db6 Signed-off-by: Junkyeong Kim --- src/tdm_capture.c | 8 ++++---- src/tdm_layer.c | 6 +++--- src/tdm_pp.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tdm_capture.c b/src/tdm_capture.c index d50e9c1..5054136 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -130,7 +130,7 @@ _tdm_capture_thread_cb_done(tdm_private_display *private_display, void *object, if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(buffer, 0); - TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } if (!LIST_IS_EMPTY(&private_capture->buffer_list)) { @@ -447,7 +447,7 @@ tdm_capture_destroy_internal(tdm_private_capture *private_capture) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(b->buffer, 0); - TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->buffer); @@ -472,7 +472,7 @@ tdm_capture_destroy_internal(tdm_private_capture *private_capture) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(b->buffer, 0); - TDM_TRACE_ASYNC_END((int)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_capture, "[CAPTURE] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->buffer); @@ -643,7 +643,7 @@ tdm_capture_attach(tdm_capture *capture, tbm_surface_h buffer) if (tdm_ttrace_module & TDM_TTRACE_CAPTURE) { tbm_bo bo = tbm_surface_internal_get_bo(buffer, 0); - TDM_TRACE_ASYNC_BEGIN((int)capture, "[CAPTURE] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((intptr_t)capture, "[CAPTURE] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); diff --git a/src/tdm_layer.c b/src/tdm_layer.c index d7c20e6..b6f07f0 100644 --- a/src/tdm_layer.c +++ b/src/tdm_layer.c @@ -536,7 +536,7 @@ tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h bu if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0); - TDM_TRACE_ASYNC_END((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } tbm_surface_internal_unref(private_layer->pending_buffer); @@ -554,7 +554,7 @@ tdm_layer_set_buffer_internal(tdm_private_layer *private_layer, tbm_surface_h bu if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->pending_buffer, 0); - TDM_TRACE_ASYNC_BEGIN((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } return TDM_ERROR_NONE; @@ -648,7 +648,7 @@ tdm_layer_committed(tdm_private_layer *private_layer, tdm_private_layer_buffer * if (private_layer->showing_buffer) { if (tdm_ttrace_module & TDM_TTRACE_LAYER) { tbm_bo bo = tbm_surface_internal_get_bo(private_layer->showing_buffer->buffer, 0); - TDM_TRACE_ASYNC_END((int)private_layer, "[LAYER] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_layer, "[LAYER] %d", tbm_bo_export(bo)); } tdm_layer_free_buffer(private_layer, private_layer->showing_buffer); diff --git a/src/tdm_pp.c b/src/tdm_pp.c index f0d249d..ea3f5f0 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -147,7 +147,7 @@ _tdm_pp_thread_cb_done(tdm_private_display *private_display, void *object, tdm_t if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(dst, 0); - TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); @@ -376,7 +376,7 @@ tdm_pp_destroy_internal(tdm_private_pp *private_pp) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(b->dst, 0); - TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->src); @@ -402,7 +402,7 @@ tdm_pp_destroy_internal(tdm_private_pp *private_pp) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(b->dst, 0); - TDM_TRACE_ASYNC_END((int)private_pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_END((intptr_t)private_pp, "[PP] %d", tbm_bo_export(bo)); } tdm_buffer_unref_backend(b->src); @@ -579,7 +579,7 @@ tdm_pp_attach(tdm_pp *pp, tbm_surface_h src, tbm_surface_h dst) if (tdm_ttrace_module & TDM_TTRACE_PP) { tbm_bo bo = tbm_surface_internal_get_bo(dst, 0); - TDM_TRACE_ASYNC_BEGIN((int)pp, "[PP] %d", tbm_bo_export(bo)); + TDM_TRACE_ASYNC_BEGIN((intptr_t)pp, "[PP] %d", tbm_bo_export(bo)); } _pthread_mutex_unlock(&private_display->lock); -- 2.7.4 From f3bc537957e32a5ba7686c3fbd507de14b79be79 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 17 Apr 2023 19:58:34 +0900 Subject: [PATCH 09/16] Fix sign extension error Change-Id: I9814ae158f31e2b11c27d82c75a4418150fb61c6 Signed-off-by: Junkyeong Kim --- backends/dummy/tdm_dummy_display.c | 2 +- backends/virtual/tdm_virtual_display.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/dummy/tdm_dummy_display.c b/backends/dummy/tdm_dummy_display.c index f2ef815..0db047d 100644 --- a/backends/dummy/tdm_dummy_display.c +++ b/backends/dummy/tdm_dummy_display.c @@ -94,7 +94,7 @@ _tdm_dummy_display_cb_timeout(void *user_data) sequence++; if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) { - tv_sec = tp.tv_sec; + tv_sec = (long)tp.tv_sec; tv_usec = tp.tv_nsec / 1000; } else { tv_sec = tv_usec = 0; diff --git a/backends/virtual/tdm_virtual_display.c b/backends/virtual/tdm_virtual_display.c index a4d523d..23d85aa 100644 --- a/backends/virtual/tdm_virtual_display.c +++ b/backends/virtual/tdm_virtual_display.c @@ -45,7 +45,7 @@ static void _tdm_virtual_get_current_time(long *tv_sec, long *tv_usec) struct timespec tp; if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) { - *tv_sec = tp.tv_sec; + *tv_sec = (long)tp.tv_sec; *tv_usec = tp.tv_nsec / 1000; } else { *tv_sec = *tv_usec = 0; -- 2.7.4 From ebe257a432159e09d9ac56a70f38b0f2dc53f0c9 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 27 Apr 2023 16:27:00 +0900 Subject: [PATCH 10/16] tdm_thread: Set tdm thread name Change-Id: I9ed62774747c2300f5441686f1cd66e9586abef8 Signed-off-by: Junkyeong Kim --- src/tdm_thread.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 40d7859..f0332cc 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -274,6 +274,8 @@ tdm_thread_init(tdm_private_loop *private_loop) pthread_create(&private_thread->event_thread, NULL, _tdm_thread_main, private_thread); + pthread_setname_np(private_thread->event_thread, "tdm_thread"); + /* wait until the tdm thread starts */ pthread_cond_wait(&private_thread->event_cond, &private_display->lock); tdm_mutex_locked = 1; -- 2.7.4 From f7ccf6642255226420e56ce1d40ad203ac324e0e Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 27 Apr 2023 16:50:48 +0900 Subject: [PATCH 11/16] Package version up to 3.1.6 Change-Id: If3ad2932ae64dde02696768ba404bba7dfb480e6 Signed-off-by: Junkyeong Kim --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index d292205..827c784 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 3.1.5 +Version: 3.1.6 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 6c30b8536a47c51de0afb525d2bf3246e395a4e7 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Fri, 19 May 2023 18:22:08 +0900 Subject: [PATCH 12/16] hwc: Add ttrace tag of hwc Change-Id: I539ae9d5c37f4ee7c1786f0d8c34362c71e2343e --- src/tdm_display.c | 2 + src/tdm_hwc.c | 142 +++++++++++++++++++++++++++++++++-------------- src/tdm_monitor_server.c | 2 +- src/tdm_private_types.h | 1 + 4 files changed, 104 insertions(+), 43 deletions(-) diff --git a/src/tdm_display.c b/src/tdm_display.c index 46cd486..85a026e 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -338,6 +338,8 @@ tdm_display_enable_ttrace(tdm_private_display *private_display, const char *ttra tdm_ttrace_module |= TDM_TTRACE_PP; else if (!strncmp(arg, "capture", 7)) tdm_ttrace_module |= TDM_TTRACE_CAPTURE; + else if (!strncmp(arg, "hwc", 3)) + tdm_ttrace_module |= TDM_TTRACE_HWC; else { tdm_ttrace_module = 0; tdm_display_enable_ttrace_vblank(private_display, NULL, 0); diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 18fca9c..185ee6a 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -129,6 +129,10 @@ _tdm_hwc_thread_cb_commit(tdm_private_display *private_display, void *object, TDM_INFO("handler(%p)", hwc_commit_handler); } + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_ASYNC_END((intptr_t)hwc_commit_handler, "[HWC_COMMIT~HANDLER] %d", + private_hwc->private_output->pipe); + /* LCOV_EXCL_START */ if (private_display->print_fps) { double curr = tdm_helper_get_time(); @@ -561,6 +565,15 @@ tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_ _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) { + if (target_buffer) { + tbm_bo bo = tbm_surface_internal_get_bo(target_buffer, 0); + TDM_TRACE_BEGIN("tdm_hwc_set_client_target_buffer %d", tbm_bo_export(bo)); + } else { + TDM_TRACE_BEGIN("tdm_hwc_set_client_target_buffer NULL"); + } + } + if (tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) { /* LCOV_EXCL_START */ char str[TDM_PATH_LEN]; @@ -580,9 +593,9 @@ tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_ } else { if (!func_hwc->hwc_set_client_target_buffer) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } @@ -602,6 +615,10 @@ tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_ } } +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; @@ -653,37 +670,36 @@ tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wn _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; if (private_module->use_hal_tdm) { if (num_wnds == 0) { ret = (tdm_error)hal_tdm_hwc_validate((hal_tdm_hwc *)private_hwc->hwc_backend, NULL, 0, num_types); - - _pthread_mutex_unlock(&private_display->lock); - return ret; + goto done; } } else { if (!func_hwc->hwc_validate) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } if (num_wnds == 0) { ret = func_hwc->hwc_validate(private_hwc->hwc_backend, NULL, 0, num_types); - - _pthread_mutex_unlock(&private_display->lock); - return ret; + goto done; } } composited_wnds_backend = calloc(num_wnds, sizeof(tdm_hwc_window *)); if (!composited_wnds_backend) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_OUT_OF_MEMORY; + ret = TDM_ERROR_OUT_OF_MEMORY; + goto done; /* LCOV_EXCL_STOP */ } @@ -701,6 +717,10 @@ tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wn free(composited_wnds_backend); +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; @@ -722,6 +742,9 @@ tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; @@ -732,9 +755,9 @@ tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, } else { if (!func_hwc->hwc_get_changed_composition_types) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } @@ -743,14 +766,12 @@ tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, } if (ret != TDM_ERROR_NONE) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); - return ret; + goto done; /* LCOV_EXCL_STOP */ } if (hwc_window == NULL || composition_types == NULL) { - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_NONE; + goto done; } for (i = 0; i < *num_elements; i++) { @@ -760,14 +781,18 @@ tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements, TDM_ERR("failed! This should never happen!"); tdm_hwc_window_destroy_internal(private_hwc_window); *num_elements = 0; - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_OPERATION_FAILED; + ret = TDM_ERROR_OPERATION_FAILED; + goto done; /* LCOV_EXCL_STOP */ } hwc_window[i] = (tdm_hwc_window*)private_hwc_window; } +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; @@ -783,6 +808,9 @@ tdm_hwc_accept_validation(tdm_hwc *hwc) _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; @@ -791,14 +819,19 @@ tdm_hwc_accept_validation(tdm_hwc *hwc) } else { if (!func_hwc->hwc_validate) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } ret = func_hwc->hwc_accept_validation(private_hwc->hwc_backend); } + +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; @@ -817,6 +850,9 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; @@ -824,8 +860,8 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d if (!func_hwc->hwc_commit) { /* LCOV_EXCL_START */ TDM_WRN("not implemented!!"); - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } } @@ -847,8 +883,8 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d if (private_module == private_display->virtual_module) { if (!private_output->private_voutput) { TDM_ERR("virtual module but don't have voutput"); - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_BAD_MODULE; + ret = TDM_ERROR_BAD_MODULE; + goto done; } } @@ -862,8 +898,7 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d if (ret != TDM_ERROR_NONE) { private_hwc->regist_commit_cb = 0; TDM_ERR("hwc(%d) fail to set hwc_set_commit_handler", private_hwc->index); - _pthread_mutex_unlock(&private_display->lock); - return ret; + goto done; /* LCOV_EXCL_STOP */ } } @@ -872,8 +907,8 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d if (!hwc_commit_handler) { /* LCOV_EXCL_START */ TDM_ERR("failed: alloc memory"); - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_OUT_OF_MEMORY; + ret = TDM_ERROR_OUT_OF_MEMORY; + goto done; /* LCOV_EXCL_STOP */ } @@ -882,8 +917,7 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d if (ret != TDM_ERROR_NONE) { TDM_ERR("tdm_thread_cb_add failed"); free(hwc_commit_handler); - _pthread_mutex_unlock(&private_display->lock); - return ret; + goto done; } LIST_ADDTAIL(&hwc_commit_handler->link, &private_hwc->hwc_commit_handler_list); @@ -925,12 +959,23 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d private_hwc->index, hwc_commit_handler, func, user_data); } + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_ASYNC_BEGIN((intptr_t)hwc_commit_handler, "[HWC_COMMIT~HANDLER] %d", + private_hwc->private_output->pipe); + +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; commit_failed: /* LCOV_EXCL_START */ + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + if (hwc_commit_handler) { tdm_thread_cb_remove(private_hwc, TDM_THREAD_CB_HWC_COMMIT, hwc_commit_handler, _tdm_hwc_thread_cb_commit, NULL); @@ -954,6 +999,9 @@ tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence) _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; @@ -962,14 +1010,19 @@ tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence) } else { if (!func_hwc->hwc_get_commit_fence) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } ret = func_hwc->hwc_get_commit_fence(private_hwc->hwc_backend, commit_fence); } + +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; @@ -988,6 +1041,9 @@ tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, _pthread_mutex_lock(&private_display->lock); + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_BEGIN(__FUNCTION__); + private_module = private_hwc->private_module; func_hwc = &private_module->func_hwc; @@ -997,19 +1053,17 @@ tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, } else { if (!func_hwc->hwc_get_release_fences) { /* LCOV_EXCL_START */ - _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); - return TDM_ERROR_NOT_IMPLEMENTED; + ret = TDM_ERROR_NOT_IMPLEMENTED; + goto done; /* LCOV_EXCL_STOP */ } ret = func_hwc->hwc_get_release_fences(private_hwc->hwc_backend, num_elements, hwc_windows, fences); } - if (hwc_windows == NULL || fences == NULL) { - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_NONE; - } + if (hwc_windows == NULL || fences == NULL) + goto done; for (i = 0; i < *num_elements; i++) { private_hwc_window = _tdm_hwc_find_private_hwc_window(private_hwc, hwc_windows[i]); @@ -1018,14 +1072,18 @@ tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, TDM_ERR("failed! This should never happen!"); tdm_hwc_window_destroy_internal(private_hwc_window); *num_elements = 0; - _pthread_mutex_unlock(&private_display->lock); - return TDM_ERROR_OPERATION_FAILED; + ret = TDM_ERROR_OPERATION_FAILED; + goto done; /* LCOV_EXCL_STOP */ } hwc_windows[i] = (tdm_hwc_window*)private_hwc_window; } +done: + if (tdm_ttrace_module & TDM_TTRACE_HWC) + TDM_TRACE_END(); + _pthread_mutex_unlock(&private_display->lock); return ret; diff --git a/src/tdm_monitor_server.c b/src/tdm_monitor_server.c index 4402f3d..b3ccf7e 100644 --- a/src/tdm_monitor_server.c +++ b/src/tdm_monitor_server.c @@ -521,7 +521,7 @@ static struct { }, { "ttrace", _tdm_monitor_server_ttrace, - "enable/disable ttrace (module: none,vsync,client_vblank,server_vblank,vblank,layer,pp,capture,all", + "enable/disable ttrace (module: none,vsync,client_vblank,server_vblank,vblank,layer,pp,capture,hwc,all", "[@]", NULL }, diff --git a/src/tdm_private_types.h b/src/tdm_private_types.h index 69a2e1d..5ec9411 100644 --- a/src/tdm_private_types.h +++ b/src/tdm_private_types.h @@ -77,6 +77,7 @@ enum { TDM_TTRACE_LAYER = (1 << 4), TDM_TTRACE_PP = (1 << 5), TDM_TTRACE_CAPTURE = (1 << 6), + TDM_TTRACE_HWC = (1 << 7), }; typedef enum { -- 2.7.4 From fd3d0651f56d606845f5c5317b99bd1f7baa06e6 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 22 May 2023 13:45:50 +0900 Subject: [PATCH 13/16] hwc: fix use after free when tdm_hwc_set_vblank is enabled if hwc commit handler is called after vblank handler of hwc commit is called, data of hwc_commit_handler is used after it is freed because data of hwc_commit_handler is freed in vblank handler. this patch makes data of hwc_commit_handler is not used to user_data of tdm_hwc_commit when tdm_hwc_set_vblank is enabled. Change-Id: Ib5445e2a012906d2c2941adaa674a11b9be3b5f0 --- src/tdm_hwc.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 185ee6a..81fb042 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -176,9 +176,6 @@ _tdm_hwc_cb_commit(tdm_hwc *hwc_backend, unsigned int sequence, tdm_thread_cb_hwc_commit hwc_commit; tdm_error ret; - if (hwc_commit_handler && hwc_commit_handler->use_vblank) - return; - if (hwc_commit_handler) private_hwc = hwc_commit_handler->private_hwc; else @@ -207,9 +204,6 @@ _tdm_hwc_cb_commit_hal_tdm(hal_tdm_hwc *hwc_backend, unsigned int sequence, tdm_thread_cb_hwc_commit hwc_commit; tdm_error ret; - if (hwc_commit_handler && hwc_commit_handler->use_vblank) - return; - if (hwc_commit_handler) private_hwc = hwc_commit_handler->private_hwc; else @@ -925,8 +919,6 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d hwc_commit_handler->func = func; hwc_commit_handler->user_data = user_data; hwc_commit_handler->owner_tid = syscall(SYS_gettid); - if (hwc_use_vblank) - hwc_commit_handler->use_vblank = 1; if (private_module == private_display->virtual_module) { private_voutput = private_output->private_voutput; @@ -937,14 +929,16 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d } } - if (private_module->use_hal_tdm) - ret = (tdm_error)hal_tdm_hwc_commit((hal_tdm_hwc *)private_hwc->hwc_backend, sync, hwc_commit_handler); - else - ret = func_hwc->hwc_commit(private_hwc->hwc_backend, sync, hwc_commit_handler); - TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed); - if (hwc_use_vblank) { /* LCOV_EXCL_START */ + hwc_commit_handler->use_vblank = 1; + + if (private_module->use_hal_tdm) + ret = (tdm_error)hal_tdm_hwc_commit((hal_tdm_hwc *)private_hwc->hwc_backend, sync, NULL); + else + ret = func_hwc->hwc_commit(private_hwc->hwc_backend, sync, NULL); + TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed); + ret = _tdm_hwc_vblank(private_hwc, hwc_commit_handler); if (ret == TDM_ERROR_NONE) { if (tdm_debug_module & TDM_DEBUG_COMMIT) @@ -954,6 +948,12 @@ tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_d goto commit_failed; /* LCOV_EXCL_STOP */ } else { + if (private_module->use_hal_tdm) + ret = (tdm_error)hal_tdm_hwc_commit((hal_tdm_hwc *)private_hwc->hwc_backend, sync, hwc_commit_handler); + else + ret = func_hwc->hwc_commit(private_hwc->hwc_backend, sync, hwc_commit_handler); + TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed); + if (tdm_debug_module & TDM_DEBUG_COMMIT) TDM_INFO("hwc(%d) backend commit: handle(%p) func(%p) user_data(%p)", private_hwc->index, hwc_commit_handler, func, user_data); -- 2.7.4 From ee8218e9f75c5289371661c3a13bfa2d48e02af1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 2 Jun 2023 12:52:14 +0900 Subject: [PATCH 14/16] client: Add new API to handle pending events - If the FD is obtained through tdm_client_get_fd() and the client POLL the fd directly, the events in the default queue may not be processed if the wl_display_roundtrip_queue() is called. 1. client get fd and poll 2. client call tdm_client_output_create_vblank() <- 3. display server send event (default queue) 4. wl_display_roundtrip_queue() is called inside tdm_client_output_create_vblank() (private queue) 4.1. read_events/queue_events done 4.2. dispatch events only in private queue 5. client locked up because vblank event in default queue cannot be processed. - This problem can be solved by providing a new API that allows to handle the pending events in default queue. Change-Id: Ife737cf43edd5aa9d4c0cc464cc9f88bb69840a1 Signed-off-by: Joonbum Ko --- client/tdm_client.c | 28 ++++++++++++++++++++++++++++ client/tdm_client.h | 9 +++++++++ 2 files changed, 37 insertions(+) diff --git a/client/tdm_client.c b/client/tdm_client.c index 62eaf6e..8bfbf84 100644 --- a/client/tdm_client.c +++ b/client/tdm_client.c @@ -644,6 +644,34 @@ tdm_client_handle_events(tdm_client *client) /* LCOV_EXCL_STOP */ } +tdm_error +tdm_client_handle_pending_events(tdm_client *client) +{ + tdm_private_client *private_client; + + TDM_RETURN_VAL_IF_FAIL(client != NULL, TDM_ERROR_INVALID_PARAMETER); + + /* LCOV_EXCL_START */ + private_client = (tdm_private_client*)client; + + pthread_mutex_lock(&private_client->lock); + + if (CHECK_WL_PROTOCOL_ERROR(private_client)) { + pthread_mutex_unlock(&private_client->lock); + return TDM_ERROR_PROTOCOL_ERROR; + } + + if (wl_display_dispatch_pending(private_client->display) < 0 ) { + pthread_mutex_unlock(&private_client->lock); + return TDM_ERROR_OPERATION_FAILED; + } + + pthread_mutex_unlock(&private_client->lock); + + return TDM_ERROR_NONE; + /* LCOV_EXCL_STOP */ +} + static int _tdm_client_poll(struct wl_display *display, short int events, int timeout) { diff --git a/client/tdm_client.h b/client/tdm_client.h index 7f5d247..92dd6bf 100644 --- a/client/tdm_client.h +++ b/client/tdm_client.h @@ -129,6 +129,15 @@ tdm_error tdm_client_handle_events_timeout(tdm_client *client, int ms_timeout); /** + * @brief Handle the pending events of the given tdm_client + * @param[in] client A TDM client object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @see #tdm_client_get_fd + */ +tdm_error +tdm_client_handle_pending_events(tdm_client *client); + +/** * @brief @b Deprecated. Wait for VBLANK. * @deprecated * @details After interval vblanks, a client vblank handler will be called. -- 2.7.4 From 70f532973dd90821917ecbf87d3db7e3f9d89866 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 8 Jun 2023 16:31:31 +0900 Subject: [PATCH 15/16] Package version up to 3.1.7 Change-Id: I53af9f94ec1b33f7c4588035e3cae7404cf499f4 Signed-off-by: Joonbum Ko --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 827c784..55ed0c8 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 3.1.6 +Version: 3.1.7 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 257a5b09ff1b6192fcebc9f53054f545c1842b58 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 3 Jul 2023 11:27:50 +0900 Subject: [PATCH 16/16] Fix build error of maybe-uninitialized Change-Id: I3a0bed5419b07369f90b813c2367912493b4565d --- haltests/src/tc_tdm_client.cpp | 2 ++ haltests/src/tc_tdm_helper.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/haltests/src/tc_tdm_client.cpp b/haltests/src/tc_tdm_client.cpp index ee35135..93fc1c5 100644 --- a/haltests/src/tc_tdm_client.cpp +++ b/haltests/src/tc_tdm_client.cpp @@ -1729,6 +1729,8 @@ TEST_F(TDMVirtualOutput, FailTestSetAvailableModes) return; } + _tc_tdm_client_virutual_make_available_mode(modes, count); + ret = tdm_client_voutput_set_available_modes(NULL, modes, count); EXPECT_EQ(ret, TDM_ERROR_INVALID_PARAMETER); diff --git a/haltests/src/tc_tdm_helper.cpp b/haltests/src/tc_tdm_helper.cpp index 56e5a43..4eb554c 100644 --- a/haltests/src/tc_tdm_helper.cpp +++ b/haltests/src/tc_tdm_helper.cpp @@ -94,6 +94,7 @@ TEST_P(TDMHelper, HelperDumpBufferAR24) TEST_P(TDMHelper, HelperDumpBufferNullObject) { char filename[256]; + snprintf(filename, sizeof filename, "/tmp/%s.png", typeid(*this).name()); tdm_helper_dump_buffer(NULL, (const char*)filename); } -- 2.7.4