From 9562d70759870343e28c867a1bc40361ab2ea2a5 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 3 Jun 2020 19:27:29 +0900 Subject: [PATCH 01/16] tdm_helper: do not include coverage checking layer_info related code. hwc mode is default enabled. if hwc mode enabled, tdm_layer related code is not supported Change-Id: I5990e8f544e17533954478fb71a5109632d6fb2e Signed-off-by: Junkyeong Kim --- src/tdm_helper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tdm_helper.c b/src/tdm_helper.c index 696fc58..469f9b0 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -717,7 +717,7 @@ tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer, TDM_RETURN_VAL_IF_FAIL(w >= 0, TDM_ERROR_INVALID_PARAMETER); TDM_RETURN_VAL_IF_FAIL(h >= 0, TDM_ERROR_INVALID_PARAMETER); TDM_RETURN_VAL_IF_FAIL(func != NULL, TDM_ERROR_INVALID_PARAMETER); - +/* LCOV_EXCL_START */ err = tdm_output_get_layer_count(output, &count); if (err != TDM_ERROR_NONE) { TDM_ERR("tdm_output_get_layer_count fail(%d)\n", err); @@ -745,6 +745,7 @@ tdm_helper_capture_output(tdm_output *output, tbm_surface_h dst_buffer, func(dst_buffer, data); return TDM_ERROR_NONE; +/* LCOV_EXCL_STOP */ } static char * @@ -868,6 +869,7 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re continue; } +/* LCOV_EXCL_START */ LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) { if (!private_layer->usable) { tdm_info_layer info; @@ -955,6 +957,7 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re } } } +/* LCOV_EXCL_STOP */ } } if (LIST_IS_EMPTY(&private_module->output_list)) -- 2.7.4 From 94b8c4919e3eb824582d492c2896985ac1095608 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 5 Jun 2020 10:35:06 +0900 Subject: [PATCH 02/16] haltest: add hwc property functions tc Change-Id: I99dbb20d9c669879d0c5c9d3c203cd2b13ade345 Signed-off-by: Junkyeong Kim --- haltests/src/tc_tdm_hwc.cpp | 203 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 202 insertions(+), 1 deletion(-) diff --git a/haltests/src/tc_tdm_hwc.cpp b/haltests/src/tc_tdm_hwc.cpp index b3618e9..8307bed 100644 --- a/haltests/src/tc_tdm_hwc.cpp +++ b/haltests/src/tc_tdm_hwc.cpp @@ -135,6 +135,100 @@ TEST_P(TDMHwc, GetSupportedFormatsSuccessful) } } + +/* tdm_hwc_get_video_available_properties() */ +TEST_P(TDMHwc, GetAvailableVideoPropertiesFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + const tdm_prop *props; + int count; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_video_available_properties(NULL, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + + error = tdm_hwc_get_video_available_properties(hwc, NULL, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + + error = tdm_hwc_get_video_available_properties(hwc, &props, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_get_video_available_properties(hwc, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, GetAvailableVideoPropertiesSuccess) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + const tdm_prop *props; + int count; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_video_available_properties(hwc, &props, &count); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + } else { + error = tdm_hwc_get_video_available_properties(hwc, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_get_capabilities() */ +TEST_P(TDMHwc, GetAvailableCapabilitiesFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_hwc_capability hwc_caps; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_capabilities(NULL, &hwc_caps); + ASSERT_NE(TDM_ERROR_NONE, error); + + error = tdm_hwc_get_capabilities(hwc, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_get_capabilities(hwc, &hwc_caps); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, GetAvailableCapabilitiesSuccess) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_hwc_capability hwc_caps; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_capabilities(hwc, &hwc_caps); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + } else { + error = tdm_hwc_get_capabilities(hwc, &hwc_caps); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + /* tdm_hwc_get_available_properties() */ TEST_P(TDMHwc, GetAvailablePropertiesFailNullWin) { @@ -518,6 +612,113 @@ TEST_P(TDMHwc, CommitSuccessful) } } +/* tdm_hwc_set_property() */ +TEST_P(TDMHwc, SetPropertyFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_value value; + + value.u32 = 0; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_set_property(NULL, 0, value); + ASSERT_EQ(TDM_ERROR_INVALID_PARAMETER, error); + } else { + error = tdm_hwc_set_property(hwc, 0, value); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, SetPropertySuccess) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + const tdm_prop *props; + int count; + tdm_value value; + + value.u32 = 0; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_available_properties(hwc, &props, &count); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + + if (count == 0) { + error = tdm_hwc_set_property(hwc, 0, value); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + } else { + error = tdm_hwc_set_property(hwc, props[0].id, value); + ASSERT_EQ(TDM_ERROR_NONE, error); + } + } else { + error = tdm_hwc_set_property(hwc, 0, value); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_get_property() */ +TEST_P(TDMHwc, GetPropertyFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_value value; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_property(NULL, 0, &value); + ASSERT_EQ(TDM_ERROR_INVALID_PARAMETER, error); + } else { + error = tdm_hwc_get_property(hwc, 0, &value); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, GetPropertySuccess) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + const tdm_prop *props; + int count; + tdm_value value; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + + if (hwc) { + error = tdm_hwc_get_available_properties(hwc, &props, &count); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + + if (count == 0) { + error = tdm_hwc_get_property(hwc, 0, &value); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + } else { + error = tdm_hwc_get_property(hwc, props[0].id, &value); + ASSERT_EQ(TDM_ERROR_NONE, error); + } + } else { + error = tdm_hwc_get_property(hwc, 0, &value); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + #ifdef TDM_UT_TEST_WITH_PARAMS INSTANTIATE_TEST_CASE_P(TDMHwcParams, TDMHwc, @@ -528,4 +729,4 @@ INSTANTIATE_TEST_CASE_P(TDMHwcParams, Values(TDM_DEFAULT_MODULE)); #endif -/* LCOV_EXCL_END */ \ No newline at end of file +/* LCOV_EXCL_END */ -- 2.7.4 From 533e517314802c30ac8a404dc9531ad35998bfd6 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 5 Jun 2020 10:37:19 +0900 Subject: [PATCH 03/16] haltest: add pp preferred_align_vertical tc Change-Id: I1f8fd5980f036a21f0736d45c4679e111ebd977a Signed-off-by: Junkyeong Kim --- haltests/src/tc_tdm_backend_pp.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/haltests/src/tc_tdm_backend_pp.cpp b/haltests/src/tc_tdm_backend_pp.cpp index e1087bc..1dd8760 100644 --- a/haltests/src/tc_tdm_backend_pp.cpp +++ b/haltests/src/tc_tdm_backend_pp.cpp @@ -44,6 +44,7 @@ public: int max_w; int max_h; int preferred_align; + int preferred_align_vertical; tbm_surface_h srcbuf[3]; tbm_surface_h dstbuf[3]; @@ -118,6 +119,8 @@ void TDMBackendPP::SetUp(void) ASSERT_TRUE(max_w == -1 || max_w > 0); ASSERT_TRUE(max_h == -1 || max_h > 0); ASSERT_TRUE(preferred_align == -1 || preferred_align > 0); + ASSERT_EQ(tdm_display_get_pp_preferred_align_vertical(dpy, &preferred_align_vertical), TDM_ERROR_NONE); + ASSERT_TRUE(preferred_align_vertical == -1 || preferred_align_vertical > 0); for (int o = 0; o < output_count; o++) { if (!tc_tdm_output_is_connected(outputs[o])) @@ -166,6 +169,10 @@ bool TDMBackendPP::PrepareBuffers(int sw, int sh, tbm_format sf, int dw, int dh, sw = TDM_UT_SIZE_ALIGN(sw, preferred_align); dw = TDM_UT_SIZE_ALIGN(dw, preferred_align); + if (preferred_align_vertical > 0) { + sh = TDM_UT_SIZE_ALIGN(sh, preferred_align_vertical); + dh = TDM_UT_SIZE_ALIGN(dh, preferred_align_vertical); + } if (capabilities & TDM_PP_CAPABILITY_SCANOUT) src_flags = dst_flags |= TBM_BO_SCANOUT; @@ -437,6 +444,14 @@ TEST_P(TDMBackendPP, PPDispalyGetAvaiableSizeNullOther) } } +TEST_P(TDMBackendPP, PPDispalyGetPreferredAlignVerticalNullObject) +{ + if (tc_tdm_display_has_pp_capability(dpy)) { + ASSERT_EQ(PreparePP(), true); + ASSERT_EQ(tdm_display_get_pp_preferred_align_vertical(NULL, NULL), TDM_ERROR_INVALID_PARAMETER); + } +} + TEST_P(TDMBackendPP, PPDestroy) { TDM_UT_SKIP_FLAG(tc_tdm_display_has_pp_capability(dpy)); -- 2.7.4 From 724bd0eed716fe7374dae473f30b5e3bad08d431 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 5 Jun 2020 10:37:57 +0900 Subject: [PATCH 04/16] package version up to 2.10.8 Change-Id: I830fac6f4317c807548cea168a85921b32309622 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 6b38311..9dba25f 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.10.7 +Version: 2.10.8 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 644b312c33055b916e9726dfb8e8be8bb3bc231c Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 15 Jun 2020 19:30:21 +0900 Subject: [PATCH 05/16] tdm_hwc: add null check Change-Id: I7f1bd8a7412f8ca980232cdaff072f9a76c78103 Signed-off-by: Junkyeong Kim --- src/tdm_hwc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 3131ebd..ea96cc8 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -212,6 +212,7 @@ _tdm_hwc_cb_wait_vblank(tdm_vblank *vblank, tdm_error error, unsigned int sequen return; TDM_RETURN_IF_FAIL(hwc_commit_handler != NULL); + TDM_RETURN_IF_FAIL(hwc_commit_handler->private_hwc != NULL); private_output = hwc_commit_handler->private_hwc->private_output; TDM_RETURN_IF_FAIL(private_output != NULL); -- 2.7.4 From efb743bd507754d6c6b97a168b3af7316e1bfcc8 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 15 Jun 2020 19:32:27 +0900 Subject: [PATCH 06/16] tdm_hwc: change use_vblank and layer_waiting_vblank flag setting position Change-Id: I4a6c3804c87612d40e72a69860bb53f54df259cc Signed-off-by: Junkyeong Kim --- src/tdm_hwc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index ea96cc8..31394a5 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -250,17 +250,19 @@ _tdm_hwc_vblank(tdm_private_hwc *private_hwc, tdm_private_hwc_commit_handler *hw if (ret != TDM_ERROR_NONE) goto done; + hwc_commit_handler->use_vblank = 1; + private_output->layer_waiting_vblank = 1; + /* tdm_vblank APIs is for server. it should be called in unlock status*/ _pthread_mutex_unlock(&private_display->lock); ret = tdm_vblank_wait(private_output->vblank, 0, 0, 1, _tdm_hwc_cb_wait_vblank, hwc_commit_handler); _pthread_mutex_lock(&private_display->lock); if (ret != TDM_ERROR_NONE) { - if (!TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) - goto done; + if (!TDM_OUTPUT_DPMS_VSYNC_IS_OFF(private_output->current_dpms_value)) { + hwc_commit_handler->use_vblank = 0; + private_output->layer_waiting_vblank = 0; + } } - - hwc_commit_handler->use_vblank = 1; - private_output->layer_waiting_vblank = 1; } done: -- 2.7.4 From 3c8572680a3f6a87a634001546bc0b391a1443f9 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 15 Jun 2020 19:34:27 +0900 Subject: [PATCH 07/16] tdm_hwc: check hwc_commit_handler's validation before list deleting. Change-Id: Id5c37bc169b0fb982ba1261823333cf8c7587933 Signed-off-by: Junkyeong Kim --- src/tdm_hwc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 31394a5..5f43860 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -86,6 +86,22 @@ _tdm_hwc_find_private_hwc_window(tdm_private_hwc *private_hwc, tdm_hwc_window *h return NULL; } +static tdm_error +_tdm_hwc_check_hwc_commit_handler_validation(tdm_private_hwc *private_hwc, tdm_private_hwc_commit_handler *hwc_commit_handler) +{ + tdm_private_hwc_commit_handler *commit_handler = NULL; + + if (LIST_IS_EMPTY(&private_hwc->hwc_commit_handler_list)) + return TDM_ERROR_INVALID_PARAMETER; + + LIST_FOR_EACH_ENTRY(commit_handler, &private_hwc->hwc_commit_handler_list, link) { + if (commit_handler == hwc_commit_handler) + return TDM_ERROR_NONE; + } + + return TDM_ERROR_INVALID_PARAMETER; +} + static void _tdm_hwc_thread_cb_commit(tdm_private_display *private_display, void *object, tdm_thread_cb_base *cb_base, void *user_data) @@ -104,6 +120,8 @@ _tdm_hwc_thread_cb_commit(tdm_private_display *private_display, void *object, tdm_thread_cb_remove(private_hwc, TDM_THREAD_CB_HWC_COMMIT, hwc_commit_handler, _tdm_hwc_thread_cb_commit, NULL); + TDM_RETURN_IF_FAIL(_tdm_hwc_check_hwc_commit_handler_validation(private_hwc, hwc_commit_handler) == TDM_ERROR_NONE) + LIST_DEL(&hwc_commit_handler->link); if (tdm_debug_module & TDM_DEBUG_COMMIT) { -- 2.7.4 From 3a9b058ac794295087dd3f2e4afc5d65c98b7cd8 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 15 Jun 2020 19:35:44 +0900 Subject: [PATCH 08/16] package version up to 2.10.9 Change-Id: Ibed0348bd3ef201755b608a7ab702a39b4567674 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 9dba25f..d9141d5 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.10.8 +Version: 2.10.9 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 4b2f0b562b56c1f440def12a44c10b6240f60b06 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 19 Jun 2020 13:29:58 +0900 Subject: [PATCH 09/16] tdm_common: add no transform pp capability Change-Id: Iec0145551cd100f27aea256270c237fd6fcd5732 Signed-off-by: Junkyeong Kim --- include/tdm_common.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/tdm_common.h b/include/tdm_common.h index bfb4cc6..eb856a7 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -145,10 +145,11 @@ typedef enum { * what a backend doesn't support like TDM_PP_CAPABILITY_NO_CSC. */ typedef enum { - TDM_PP_CAPABILITY_SYNC = (1 << 0), /**< The pp device supports synchronous operation */ - TDM_PP_CAPABILITY_ASYNC = (1 << 1), /**< The pp device supports asynchronous operation */ - TDM_PP_CAPABILITY_SCANOUT = (1 << 4), /**< The pp device supports only scanout buffer */ - TDM_PP_CAPABILITY_NO_CSC = (1 << 5), /**< The pp device doesn't supports Color Space Conversion */ + TDM_PP_CAPABILITY_SYNC = (1 << 0), /**< The pp device supports synchronous operation */ + TDM_PP_CAPABILITY_ASYNC = (1 << 1), /**< The pp device supports asynchronous operation */ + TDM_PP_CAPABILITY_SCANOUT = (1 << 4), /**< The pp device supports only scanout buffer */ + TDM_PP_CAPABILITY_NO_CSC = (1 << 5), /**< The pp device doesn't support Color Space Conversion */ + TDM_PP_CAPABILITY_NO_TRANSFORM_ROTATION = (1 << 6), /**< The pp device doesn't support rotation transform */ } tdm_pp_capability; /** -- 2.7.4 From c963331b3ff99f6eeea0d6fa358d48fcda7b0120 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 19 Jun 2020 15:36:46 +0900 Subject: [PATCH 10/16] package version up to 2.10.10 Change-Id: I7c41754fe5d9a59ff5e378c25dd7b189d4b06efd 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 d9141d5..06a44cf 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.10.9 +Version: 2.10.10 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 4f2ba911f53218aeb8ec9b95efc5947061354275 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 22 Jun 2020 13:26:27 +0900 Subject: [PATCH 11/16] tdm_hwc: add fence api and backend interface add fence api in tdm.h tdm_error tdm_hwc_set_client_target_acquire_fence(tdm_hwc *hwc, int acquire_fence) tdm_error tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence) tdm_error tdm_hwc_window_set_acquire_fence(tdm_hwc_window *hwc_window, int acquire_fence) tdm_common.h TDM_HWC_CAPABILITY_FENCE backend interface tdm_error (*hwc_set_client_target_acquire_fence)(tdm_hwc *hwc, int acquire_fence) tdm_error (*hwc_get_commit_fence)(tdm_hwc *hwc, int *commit_fence); tdm_error (*hwc_window_set_acquire_fence)(tdm_hwc_window *hwc_window, int acquire_fence) Change-Id: I706a27341fa14c6cd1bc4ec8fb49bd4f7a8079c8 --- include/tdm.h | 29 +++++++++++++++++++++++++++ include/tdm_backend.h | 30 ++++++++++++++++++++++++++++ include/tdm_common.h | 1 + src/tdm_hwc.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/tdm_hwc_window.c | 26 ++++++++++++++++++++++++ 5 files changed, 141 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 685c4ec..d064db3 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -992,6 +992,15 @@ tdm_error tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_region damage); /** + * @brief Set the acquire fence fd of client(relative to the TDM) target + * @param[in] hwc A output hwc + * @param[in] acquire_fence The acquire fence fd of target + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_set_client_target_acquire_fence(tdm_hwc *hwc, int acquire_fence); + +/** * @brief Validate the output * @details Instructs the backend to inspect all of the hw layer state and * determine if there are any composition type changes necessary before @@ -1059,6 +1068,17 @@ tdm_error tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data); /** + * @brief Get commit fence + * @details After all change of a window object are applied to last tdm_hwc_commit, + * the fence is signaled. + * @param[in] hwc A hwc object + * @param[out] commit_fence the commit fence fd of tdm_hwc_commit + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence); + +/** * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id @@ -1220,6 +1240,15 @@ tdm_error tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr); /** + * @brief Set the acquire fence of hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] acquire_fence the acquire fence fd of a hwc window object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_window_set_acquire_fence(tdm_hwc_window *hwc_window, int acquire_fence); + +/** * @brief Destroy a pp object * @param[in] pp A pp object * @see tdm_display_create_pp diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 8d6bba9..60ddd1a 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -891,6 +891,17 @@ typedef struct _tdm_func_hwc { tdm_region damage); /** + * @brief Set the acquire fence of client(relative to the TDM) target buffer + * @param[in] hwc A output hwc + * @param[in] acquire_fence The acquire fence fd of target + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @since 2.0.0 + */ + tdm_error (*hwc_set_client_target_acquire_fence)(tdm_hwc *hwc, + int acquire_fence); + + + /** * @brief Validate the hwc * @details Instructs the backend to inspect all of the hw layer state and * determine if there are any composition type changes necessary before @@ -965,6 +976,16 @@ typedef struct _tdm_func_hwc { tdm_error (*hwc_set_commit_handler)(tdm_hwc *hwc, tdm_hwc_commit_handler func); /** + * @brief Get commit fence + * @details After all change of a window object are applied about last tdm_hwc_commit, + * the fence is signaled. + * @param[in] hwc A hwc object + * @param[out] commit_fence the commit fence fd of tdm_hwc_commit + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_get_commit_fence)(tdm_hwc *hwc, int *commit_fence); + + /** * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id @@ -1120,6 +1141,15 @@ typedef struct _tdm_func_hwc_window { */ tdm_error (*hwc_window_set_cursor_image)(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr); + + /** + * @brief Set the acquire fence of hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] acquire_fence the acquire fence fd of a hwc window object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_window_set_acquire_fence)(tdm_hwc_window *hwc_window, + int acquire_fence); } tdm_func_hwc_window; /** diff --git a/include/tdm_common.h b/include/tdm_common.h index eb856a7..a661a6d 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -270,6 +270,7 @@ typedef enum { TDM_HWC_CAPABILITY_VIDEO_SCALE = (1 << 2), /**< if a hwc allows to scale the video buffer */ TDM_HWC_CAPABILITY_VIDEO_TRANSFORM = (1 << 3), /**< if a hwc allows video to transform the video buffer */ TDM_HWC_CAPABILITY_VIDEO_SCANOUT = (1 << 4), /**< if a hwc allows video to accept the scanout buffer only */ + TDM_HWC_CAPABILITY_FENCE = (1 << 5), /**< if a hwc allows fence */ } tdm_hwc_capability; /** diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 5f43860..9238b29 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -524,6 +524,33 @@ tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_ return ret; } +EXTERN tdm_error +tdm_hwc_set_client_target_acquire_fence(tdm_hwc *hwc, int acquire_fence) +{ + tdm_private_module *private_module; + tdm_func_hwc *func_hwc = NULL; + + HWC_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_hwc->private_module; + func_hwc = &private_module->func_hwc; + + if (!func_hwc->hwc_set_client_target_acquire_fence) { + /* LCOV_EXCL_START */ + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + /* LCOV_EXCL_STOP */ + } + + ret = func_hwc->hwc_set_client_target_acquire_fence(private_hwc->hwc_backend, acquire_fence); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} EXTERN tdm_error tdm_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_wnds, uint32_t *num_types) @@ -798,6 +825,34 @@ commit_failed: /* LCOV_EXCL_STOP */ } +EXTERN tdm_error +tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence) +{ + tdm_private_module *private_module; + tdm_func_hwc *func_hwc = NULL; + + HWC_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_hwc->private_module; + func_hwc = &private_module->func_hwc; + + 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; + /* LCOV_EXCL_STOP */ + } + + ret = func_hwc->hwc_get_commit_fence(private_hwc->hwc_backend, commit_fence); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + tdm_error tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value) { diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 1dd9e54..2e861d8 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -387,6 +387,32 @@ tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer) } EXTERN tdm_error +tdm_hwc_window_set_acquire_fence(tdm_hwc_window *hwc_window, int acquire_fence) +{ + tdm_private_module *private_module; + tdm_func_hwc_window *func_hwc_window; + + HWC_WINDOW_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_output->private_module; + func_hwc_window = &private_module->func_hwc_window; + + if (!func_hwc_window->hwc_window_set_acquire_fence) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc_window->hwc_window_set_acquire_fence(private_hwc_window->hwc_window_backend, acquire_fence); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + +EXTERN tdm_error tdm_hwc_window_get_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_value *value) { tdm_private_module *private_module; -- 2.7.4 From 551eb5fd697dc79c85eab90cd2b212cabe3bbd01 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 30 Jun 2020 20:43:59 +0900 Subject: [PATCH 12/16] tdm_backend: fix typo Change-Id: Ie98882fcaf2410521211cd2169e9f589fc195e45 --- include/tdm_backend.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 60ddd1a..15e5be1 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -977,10 +977,10 @@ typedef struct _tdm_func_hwc { /** * @brief Get commit fence - * @details After all change of a window object are applied about last tdm_hwc_commit, + * @details After all change of a window object are applied to last tdm_hwc_commit, * the fence is signaled. * @param[in] hwc A hwc object - * @param[out] commit_fence the commit fence fd of tdm_hwc_commit + * @param[out] commit_fence the commit fence fd of tdm_hwc_commit * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_get_commit_fence)(tdm_hwc *hwc, int *commit_fence); @@ -989,7 +989,7 @@ typedef struct _tdm_func_hwc { * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id - * @param[in] value The value of the propery id + * @param[in] value The value of the property id * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_set_property)(tdm_hwc *hwc, uint32_t id, tdm_value value); @@ -998,7 +998,7 @@ typedef struct _tdm_func_hwc { * @brief Get the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id - * @param[in] value The value of the propery id + * @param[in] value The value of the property id * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_get_property)(tdm_hwc *hwc, uint32_t id, tdm_value *value); -- 2.7.4 From 3874ada66d6b1f769b570e8a726d3a855b797984 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 24 Jun 2020 14:28:34 +0900 Subject: [PATCH 13/16] tdm_hwc: add tdm_hwc_get_release_fences interface Retrieves the windows which the backend requires setting the release fences the release fence is signaled when the backend is no longer using previous buffer. tdm_error tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_windows, int *fences); tdm_error (*tdm_hwc_get_release_fences)(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_windows, int *release_fences); Change-Id: Ie8bd337c6da2c49368263c701f2dcdcc31655f62 --- include/tdm.h | 15 +++++++++++++++ include/tdm_backend.h | 14 ++++++++++++++ src/tdm_hwc.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index d064db3..127b7f0 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1079,6 +1079,21 @@ tdm_error tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence); /** + * @brief Get release fences + * @details Retrieves the windows which the backend requires setting the release fences + * the release fence is signaled when the backend is no longer using previous buffer. + * @param[in] hwc A hwc object + * @param[out] num_elements the number of hwc_windows + * @param[out] hwc_windows An array of windows + * @param[out] release_fences An array of release fences, each corresponding + * to an element of windows + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +EXTERN tdm_error +tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, + tdm_hwc_window **hwc_windows, int *fences); + +/** * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 15e5be1..afbeb5c 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -986,6 +986,20 @@ typedef struct _tdm_func_hwc { tdm_error (*hwc_get_commit_fence)(tdm_hwc *hwc, int *commit_fence); /** + * @brief Get release fences + * @details Retrieves the windows which the backend requires setting the release fences + * the release fence is signaled when the backend is no longer using previous buffer. + * @param[in] hwc A hwc object + * @param[out] num_elements the number of hwc_windows + * @param[out] hwc_windows An array of windows + * @param[out] release_fences An array of release fences, each corresponding + * to an element of windows + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*tdm_hwc_get_release_fences)(tdm_hwc *hwc, uint32_t *num_elements, + tdm_hwc_window **hwc_windows, int *release_fences); + + /** * @brief Set the property which has a given id on the hwc object. * @param[in] hwc A hwc object * @param[in] id The property id diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 9238b29..47b6abb 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -853,6 +853,58 @@ tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence) return ret; } +EXTERN tdm_error +tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, + tdm_hwc_window **hwc_windows, int *fences) +{ + tdm_private_module *private_module; + tdm_func_hwc *func_hwc = NULL; + tdm_private_hwc_window *private_hwc_window = NULL; + int i; + + HWC_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_hwc->private_module; + func_hwc = &private_module->func_hwc; + + 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; + /* 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; + } + + for (i = 0; i < *num_elements; i++) { + private_hwc_window = _tdm_hwc_find_private_hwc_window(private_hwc, hwc_windows[i]); + if (private_hwc_window == NULL) { + /* LCOV_EXCL_START */ + 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; + /* LCOV_EXCL_STOP */ + } + + hwc_windows[i] = (tdm_hwc_window*)private_hwc_window; + } + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + tdm_error tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value) { -- 2.7.4 From b64777902e4c61f13b049d7e8e19e2962011d5d4 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 30 Jun 2020 21:28:23 +0900 Subject: [PATCH 14/16] package version up to 2.10.11 Change-Id: I4ae4545fa45894e256b857621fffab228fd68002 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 06a44cf..26b893d 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.10.10 +Version: 2.10.11 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From b3226e85cb161a13451e516c0ff2043069e80e74 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 1 Jul 2020 13:11:54 +0900 Subject: [PATCH 15/16] fix wrong backend interface name Change-Id: I79c6ddfee3b257236e1f972ddf7350f68c13b447 --- include/tdm.h | 2 +- include/tdm_backend.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tdm.h b/include/tdm.h index 127b7f0..4a9d60d 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1089,7 +1089,7 @@ tdm_hwc_get_commit_fence(tdm_hwc *hwc, int *commit_fence); * to an element of windows * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ -EXTERN tdm_error +tdm_error tdm_hwc_get_release_fences(tdm_hwc *hwc, uint32_t *num_elements, tdm_hwc_window **hwc_windows, int *fences); diff --git a/include/tdm_backend.h b/include/tdm_backend.h index afbeb5c..f1f8084 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -996,8 +996,8 @@ typedef struct _tdm_func_hwc { * to an element of windows * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ - tdm_error (*tdm_hwc_get_release_fences)(tdm_hwc *hwc, uint32_t *num_elements, - tdm_hwc_window **hwc_windows, int *release_fences); + tdm_error (*hwc_get_release_fences)(tdm_hwc *hwc, uint32_t *num_elements, + tdm_hwc_window **hwc_windows, int *release_fences); /** * @brief Set the property which has a given id on the hwc object. -- 2.7.4 From ad10e954309bb18f7f3eb57dac8ab676a562ce49 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 1 Jul 2020 19:48:12 +0900 Subject: [PATCH 16/16] log : remove print on stdout Change-Id: I3d697c277a50928ac5b3a769f8f31fee249f0dca --- include/tdm_log.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/tdm_log.h b/include/tdm_log.h index 0a9bbf3..67ea4df 100644 --- a/include/tdm_log.h +++ b/include/tdm_log.h @@ -121,9 +121,6 @@ extern unsigned int tdm_log_debug_level; if (tdm_log_debug_level >= TDM_LOG_LEVEL_INFO) { \ struct timespec ts; \ clock_gettime(CLOCK_MONOTONIC, &ts); \ - tdm_log_printf(TDM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \ - (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ - (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ tdm_log_print(TDM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \ -- 2.7.4