From 1077efadd285a710bef44551fed5c00395336b22 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Mon, 14 May 2018 15:12:41 +0900 Subject: [PATCH 01/16] thread: Do not send a value of sync as '1' to display thread (quick-fix) Sync type event from display-thread(main thread) can't be handled. In this way, if we call tdm_thread_send_cb() with 'cb_base->sync = 1', then libtdm will eveventually raise abort(). Please see commit '4abfab36' for more detail. Change-Id: Ia588141fc9e752753dbe04fda835c5532839d95e --- src/tdm_thread.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 997d772..2cc2f13 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -708,7 +708,12 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa if (!handler_in_other_thread) { if (keep_private_thread) { - if (cb_base->sync && waiting_tid != 0) { + /* NOTE quick fix + * In case of 'cb_base->sync = 0' and 'waiting_tid != 0', + * probably it means one thread is waiting for signal of + * pthread condition. + */ + if (!cb_base->sync && waiting_tid != 0) { waiting_tid = 0; pthread_cond_signal(&keep_private_thread->event_cond); if (tdm_debug_module & TDM_DEBUG_THREAD) @@ -726,11 +731,23 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa */ assert(keep_private_thread != NULL); - ret = tdm_thread_send_cb(private_display->private_loop, cb_base); - TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); - + if (!cb_base->sync) { + ret = tdm_thread_send_cb(private_display->private_loop, cb_base); + TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); + } /* waiting until all cb are done in another thread */ - if (cb_base->sync) { + else { + /* NOTE quick fix + * Sync type event from display-thread(main thread) can't be + * handled. In this way, if we call tdm_thread_send_cb() with + * 'cb_base->sync = 1', then libtdm will eveventually raise + * abort(). Please see commit '4abfab36' for more detail. + */ + cb_base->sync = 0; + ret = tdm_thread_send_cb(private_display->private_loop, cb_base); + TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, TDM_ERROR_OPERATION_FAILED); + cb_base->sync = 1; + /* if waiting_tid is not 0, it means there are two sync-type events at the same time. * and it would make deadlock issue. */ -- 2.7.4 From 58828ed23597b6ba74af0b6a76af7d04b5677e50 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 14 May 2018 15:31:48 +0900 Subject: [PATCH 02/16] package version up to 1.18.2 Change-Id: I9497d4acca1549053030f5865016d825fd17413e --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index f3d74ce..9be0331 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 1.18.1 +Version: 1.18.2 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From c62d87e018d27ccd2074b3ef26a37b60110e5d0d Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 21 May 2018 16:46:11 +0900 Subject: [PATCH 03/16] define the backend ABI version The TDM backend ABI version should be separated with TDM front-end ABI. Therefore, tdm defines the TDM backend ABI version at the tbm_backend.h. The tdm checks the module ABI version with this backend ABI version when the libtdm loads the backend modules. Change-Id: I80d842f225d261f7fc024c6928dc66c9d4a95a65 --- include/tdm_backend.h | 5 +++++ src/tdm.c | 27 ++++++++++++++++----------- src/tdm_backend.c | 10 ++-------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 53f979a..e9fc70d 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1134,6 +1134,11 @@ typedef tdm_error (*tdm_event_loop_timer_handler)(void *user_data); (((major) << 16) & TDM_BACKEND_MAJOR_VERSION_MASK) | \ ((minor) & TDM_BACKEND_MINOR_VERSION_MASK) + +#define TDM_BACKEND_ABI_VERSION_1_0 TDM_BACKEND_SET_ABI_VERSION(1, 0) +#define TDM_BACKEND_ABI_VERSION_2_0 TDM_BACKEND_SET_ABI_VERSION(2, 0) +#define TDM_BACKEND_ABI_LATEST_VERSION TDM_BACKEND_ABI_VERSION_2_0 /**< the latest version of the tdm backend abi */ + /** * @brief * This MACRO is deprecated since 1.2.0. Use TDM_BACKEND_SET_ABI_VERSION instead of this. diff --git a/src/tdm.c b/src/tdm.c index bc59c3c..6f938ec 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -745,10 +745,14 @@ static pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER; static tdm_error _tdm_display_check_module(tdm_backend_module *module) { - int major, minor; + int tdm_backend_major, tdm_backend_minor; + int backend_module_major, backend_module_minor; - TDM_INFO("TDM ABI version : %d.%d", - TDM_MAJOR_VERSION, TDM_MINOR_VERSION); + tdm_backend_major = TDM_BACKEND_GET_ABI_MAJOR(TDM_BACKEND_ABI_LATEST_VERSION); + tdm_backend_minor = TDM_BACKEND_GET_ABI_MINOR(TDM_BACKEND_ABI_LATEST_VERSION); + + TDM_INFO("TDM Backend ABI version : %d.%d", + tdm_backend_major, tdm_backend_minor); if (!module->name) { TDM_ERR("TDM backend doesn't have name"); @@ -760,22 +764,23 @@ _tdm_display_check_module(tdm_backend_module *module) return TDM_ERROR_BAD_MODULE; } - major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version); - minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version); + backend_module_major = TDM_BACKEND_GET_ABI_MAJOR(module->abi_version); + backend_module_minor = TDM_BACKEND_GET_ABI_MINOR(module->abi_version); TDM_INFO("TDM module name: %s", module->name); TDM_INFO("'%s' vendor: %s", module->name, module->vendor); - TDM_INFO("'%s' version: %d.%d", module->name, major, minor); + TDM_INFO("'%s' backend ABI version: %d.%d", module->name, backend_module_major, backend_module_minor); - if (major != TDM_MAJOR_VERSION) { - TDM_ERR("'%s' major version mismatch, %d != %d", - module->name, major, TDM_MAJOR_VERSION); + if (backend_module_major > tdm_backend_major) { + TDM_ERR("'%s' major version(%d) is newer than %d", + module->name, backend_module_major, tdm_backend_major); return TDM_ERROR_BAD_MODULE; } - if (minor > TDM_MINOR_VERSION) { + if (tdm_backend_major == backend_module_major && + backend_module_minor > tdm_backend_minor) { TDM_ERR("'%s' minor version(%d) is newer than %d", - module->name, minor, TDM_MINOR_VERSION); + module->name, backend_module_minor, tdm_backend_minor); return TDM_ERROR_BAD_MODULE; } diff --git a/src/tdm_backend.c b/src/tdm_backend.c index 13ea24c..c979129 100644 --- a/src/tdm_backend.c +++ b/src/tdm_backend.c @@ -146,10 +146,7 @@ tdm_backend_register_func_hwc(tdm_display *dpy, tdm_func_hwc *func_hwc) assert(private_display->current_module); module = private_display->current_module->module_data; - /* FIX ME: - Temporarily, we set the version of hwc window to 1.1 for the development. - Originally the hwc window version is 2.0. */ - if (_check_abi_version(module, 1, 1) < 0) + if (_check_abi_version(module, 2, 0) < 0) return TDM_ERROR_BAD_MODULE; private_display->current_module->func_hwc = *func_hwc; @@ -171,10 +168,7 @@ tdm_backend_register_func_hwc_window(tdm_display *dpy, tdm_func_hwc_window *func assert(private_display->current_module); module = private_display->current_module->module_data; - /* FIX ME: - Temporarily, we set the version of hwc window to 1.1 for the development. - Originally the hwc window version is 2.0. */ - if (_check_abi_version(module, 1, 1) < 0) + if (_check_abi_version(module, 2, 0) < 0) return TDM_ERROR_BAD_MODULE; private_display->current_module->func_hwc_window = *func_hwc_window; -- 2.7.4 From 78d22f2de14be04a4878d20649e2bc0df9fbb8c7 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 21 May 2018 16:49:58 +0900 Subject: [PATCH 04/16] package version up to 2.0.0 - add haltest cases - add the new backend APIs for the TDM-HWC at tdm_backend.h - increase the major verion of the TBM backend ABI to version 2.0 The tdm backend module needs to set the valid backend version. Change-Id: I62538cb7d634e465e007900e7b49595ea4cd9226 --- configure.ac | 4 ++-- packaging/libtdm.spec | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index dd27580..3d13ec7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ([2.60]) -m4_define([tdm_major_version], [1]) -m4_define([tdm_minor_version], [16]) +m4_define([tdm_major_version], [2]) +m4_define([tdm_minor_version], [0]) m4_define([tdm_micro_version], [0]) m4_define([tdm_version], [tdm_major_version.tdm_minor_version.tdm_micro_version]) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 9be0331..5bcae43 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 1.18.2 +Version: 2.0.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 3ada4a19f780e3d8dbe3166a7c8af0c8fee1c4f2 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 30 May 2018 10:39:46 +0900 Subject: [PATCH 05/16] tc: add tests for tdm_hwc and tdm_hwc_window Change-Id: Id19c9f11771397f60204ef5a6af07576f4da7f37 --- haltests/Makefile.am | 4 +- haltests/src/tc_tdm_hwc.cpp | 525 +++++++++++++++++++++++++++++++++++++ haltests/src/tc_tdm_hwc_window.cpp | 351 +++++++++++++++---------- haltests/src/tc_tdm_output_hwc.cpp | 429 ------------------------------ 4 files changed, 739 insertions(+), 570 deletions(-) create mode 100644 haltests/src/tc_tdm_hwc.cpp delete mode 100644 haltests/src/tc_tdm_output_hwc.cpp diff --git a/haltests/Makefile.am b/haltests/Makefile.am index 276b503..278e1ef 100644 --- a/haltests/Makefile.am +++ b/haltests/Makefile.am @@ -15,7 +15,9 @@ tdm_haltests_SOURCES = \ src/tc_tdm_backend_env.cpp \ src/tc_tdm_backend_display.cpp \ src/tc_tdm_backend_pp.cpp \ - src/tc_tdm_backend_capture.cpp + src/tc_tdm_backend_capture.cpp \ + src/tc_tdm_hwc.cpp \ + src/tc_tdm_hwc_window.cpp tdm_haltests_SOURCES += \ ../tools/buffers.c diff --git a/haltests/src/tc_tdm_hwc.cpp b/haltests/src/tc_tdm_hwc.cpp new file mode 100644 index 0000000..545c6a0 --- /dev/null +++ b/haltests/src/tc_tdm_hwc.cpp @@ -0,0 +1,525 @@ +/************************************************************************** + * + * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Contact: Konstantin Drabeniuk + * Contact: Andrii Sokolenko + * Contact: Roman Marchenko + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * +**************************************************************************/ + +#include "tc_tdm.h" + +/* LCOV_EXCL_START */ + +#define HWC_WIN_NUM 5 + +class TDMHwc : public TDMOutput +{ +public: + TDMHwc(); + void SetUp(void); + void TearDown(void); + + tdm_error error; +}; + +TDMHwc::TDMHwc() +{ + error = TDM_ERROR_NONE; +} + +void TDMHwc::SetUp(void) +{ + TDMOutput::SetUp(); +} + +void TDMHwc::TearDown(void) +{ + TDMOutput::TearDown(); +} + +static void +_tc_tdm_hwc_commit_cb(tdm_hwc *hwc, unsigned int sequence, + unsigned int tv_sec, unsigned int tv_usec, + void *user_data) +{ + bool *done = (bool*)user_data; + if (done) + *done = true; +} + +/* tdm_hwc_window * tdm_hwc_create_window(tdm_output *output, tdm_error *error); */ +TEST_P(TDMHwc, CreateWindowFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + ASSERT_EQ(NULL, tdm_hwc_create_window(NULL, &error)); + ASSERT_NE(TDM_ERROR_NONE, error); +} + +TEST_P(TDMHwc, CreateWindowSuccessful) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error; + tdm_hwc_window * hw = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + hw = tdm_hwc_create_window(hwc, &error); + ASSERT_EQ(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hw); + } else { + ASSERT_EQ(NULL, tdm_hwc_create_window(hwc, &error)); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_get_supported_formats() */ +TEST_P(TDMHwc, GetSupportedFormatsFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_error error; + + error = tdm_hwc_get_supported_formats(NULL, NULL, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); +} + +TEST_P(TDMHwc, GetSupportedFormatsSuccessful) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + const tbm_format *formats; + int count; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_supported_formats(hwc, &formats, &count); + if (error != TDM_ERROR_NOT_IMPLEMENTED) { + ASSERT_EQ(TDM_ERROR_NONE, error); + if (count > 0) + ASSERT_NE(NULL, formats); + } + } else { + error = tdm_hwc_get_supported_formats(hwc, &formats, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_get_available_properties() */ +TEST_P(TDMHwc, GetAvailablePropertiesFailNullWin) +{ + 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_available_properties(NULL, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + + error = tdm_hwc_get_available_properties(hwc, NULL, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + + error = tdm_hwc_get_available_properties(hwc, &props, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_get_available_properties(hwc, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, GetAvailablePropertiesSuccess) +{ + 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_available_properties(hwc, &props, &count); + ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + } else { + error = tdm_hwc_get_available_properties(hwc, &props, &count); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } + +} + +/* tdm_hwc_get_client_target_buffer_queue() */ +TEST_P(TDMHwc, GetClientTargetBufferQueueFailNullObject) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tbm_surface_queue_h queue = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + queue = tdm_hwc_get_client_target_buffer_queue(NULL, &error); + ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(NULL, queue); + + queue = tdm_hwc_get_client_target_buffer_queue(NULL, NULL); + ASSERT_EQ(NULL, queue); + } else { + ASSERT_EQ(NULL, queue); + } + } +} + +TEST_P(TDMHwc, GetClientTargetBufferQueueFainNoHwc) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tbm_surface_queue_h queue = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_NE(NULL, queue); + } else { + queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); + ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(NULL, queue); + } + } +} + +TEST_P(TDMHwc, GetClientTargetBufferQueueSuccessful) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tbm_surface_queue_h queue = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); + tbm_surface_queue_destroy(queue); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_NE(NULL, queue); + + queue = tdm_hwc_get_client_target_buffer_queue(hwc, NULL); + tbm_surface_queue_destroy(queue); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_NE(NULL, queue); + } else { + queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); + ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(NULL, queue); + + queue = tdm_hwc_get_client_target_buffer_queue(hwc, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(NULL, queue); + } + } +} + +/* tdm_hwc_set_client_target_buffer() */ +TEST_P(TDMHwc, SetClientTargetBufferFailNullOutput) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_region damage = {.num_rects = 0, .rects = NULL}; + tbm_surface_h target_buff = NULL; + + target_buff = tbm_surface_internal_create_with_flags(720, 1024, + TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT); + ASSERT_NE(NULL, target_buff); + + error = tdm_hwc_set_client_target_buffer(NULL, target_buff, damage); + tbm_surface_internal_destroy(target_buff); + ASSERT_NE(TDM_ERROR_NONE, error); +} + +TEST_P(TDMHwc, SetClientTargetBufferSuccessfulSetBuff) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_region damage = {.num_rects = 0, .rects = NULL}; + const tdm_output_mode *mode = NULL; + tbm_surface_h target_buff = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE); + target_buff = tbm_surface_internal_create_with_flags(mode->hdisplay, mode->vdisplay, + TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT); + ASSERT_NE(NULL, target_buff); + + error = tdm_hwc_set_client_target_buffer(hwc, target_buff, damage); + tbm_surface_internal_destroy(target_buff); + ASSERT_EQ(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_set_client_target_buffer(hwc, target_buff, damage); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, SetClientTargetBufferSuccessfulResetBuff) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_region damage = {.num_rects = 0, .rects = NULL}; + tbm_surface_h target_buff = NULL; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_set_client_target_buffer(hwc, NULL, damage); + tbm_surface_internal_destroy(target_buff); + ASSERT_EQ(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_set_client_target_buffer(hwc, NULL, damage); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_validate() */ +TEST_P(TDMHwc, ValidateFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + uint32_t num_types; + + error = tdm_hwc_validate(NULL, NULL, 0, &num_types); + ASSERT_NE(TDM_ERROR_NONE, error); + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_validate(hwc, NULL, 0, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_validate(hwc, NULL, 0, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_hwc_get_changed_composition_types() */ +TEST_P(TDMHwc, GetChangedCompositionTypesFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + uint32_t num_elements; + + error = tdm_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_get_changed_composition_types(hwc, NULL, NULL, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_get_changed_composition_types(hwc, NULL, NULL, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_error tdm_hwc_accept_changes() */ +TEST_P(TDMHwc, AcceptChangesFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + error = tdm_hwc_accept_changes(NULL); + ASSERT_NE(TDM_ERROR_NONE, error); +} + +TEST_P(TDMHwc, AcceptChangesFailNoHwc) +{ + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + error = tdm_hwc_accept_changes(hwc); + ASSERT_NE(TDM_ERROR_NONE, error); + } else { + error = tdm_hwc_accept_changes(hwc); + ASSERT_NE(TDM_ERROR_NONE, error); + } + } +} + +TEST_P(TDMHwc, AcceptChangesSuccessful) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_hwc_window *hwc_wnds[HWC_WIN_NUM]; + tdm_hwc_window **changed_hwc_window = NULL; + tdm_hwc_window_composition *composition_types = NULL; + uint32_t num_types; + uint32_t get_num = 0; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + for (int w = 0; w < HWC_WIN_NUM; w++) { + hwc_wnds[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_EQ(TDM_ERROR_NONE, error); + error = tdm_hwc_window_set_composition_type(hwc_wnds[w], TDM_COMPOSITION_DEVICE); + ASSERT_EQ(TDM_ERROR_NONE, error); + } + + error = tdm_hwc_validate(hwc, hwc_wnds, HWC_WIN_NUM, &num_types); + ASSERT_EQ(TDM_ERROR_NONE, error); + + if (num_types > 0) { + changed_hwc_window = (tdm_hwc_window **)calloc(num_types, sizeof(tdm_hwc_window *)); + composition_types = (tdm_hwc_window_composition *)calloc(num_types, sizeof(tdm_hwc_window_composition)); + + error = tdm_hwc_get_changed_composition_types(hwc, &get_num, changed_hwc_window, composition_types); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_EQ(get_num, num_types); + + error = tdm_hwc_accept_changes(hwc); + ASSERT_EQ(TDM_ERROR_NONE, error); + + free(composition_types); + free(changed_hwc_window); + } + + for (int w = 0; w < HWC_WIN_NUM; w++) + tdm_hwc_window_destroy(hwc_wnds[w]); + + ASSERT_EQ(TDM_ERROR_NONE, error); + } + } +} + +/* tdm_error tdm_hwc_commit() */ +TEST_P(TDMHwc, CommitFailNull) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + error = tdm_hwc_commit(NULL, 1, NULL, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); +} + +TEST_P(TDMHwc, CommitSuccessful) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; + tdm_hwc_window *hwc_wnds[HWC_WIN_NUM]; + tdm_hwc_window **changed_hwc_window = NULL; + tdm_hwc_window_composition *composition_types = NULL; + uint32_t num_types; + uint32_t get_num = 0; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(outputs[o], &error); + if (hwc) { + for (int w = 0; w < HWC_WIN_NUM; w++) { + hwc_wnds[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_EQ(TDM_ERROR_NONE, error); + error = tdm_hwc_window_set_composition_type(hwc_wnds[w], TDM_COMPOSITION_DEVICE); + ASSERT_EQ(TDM_ERROR_NONE, error); + } + + error = tdm_hwc_validate(hwc, hwc_wnds, HWC_WIN_NUM, &num_types); + ASSERT_EQ(TDM_ERROR_NONE, error); + + if (num_types > 0) { + changed_hwc_window = (tdm_hwc_window **)calloc(num_types, sizeof(tdm_hwc_window *)); + composition_types = (tdm_hwc_window_composition *)calloc(num_types, sizeof(tdm_hwc_window_composition)); + + error = tdm_hwc_get_changed_composition_types(hwc, &get_num, changed_hwc_window, composition_types); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_EQ(get_num, num_types); + + error = tdm_hwc_accept_changes(hwc); + ASSERT_EQ(TDM_ERROR_NONE, error); + + free(composition_types); + free(changed_hwc_window); + } + + error = tdm_hwc_commit(hwc, 0, _tc_tdm_hwc_commit_cb, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + + for (int w = 0; w < HWC_WIN_NUM; w++) + tdm_hwc_window_destroy(hwc_wnds[w]); + + ASSERT_EQ(TDM_ERROR_NONE, error); + } + } +} + +#ifdef TDM_UT_TEST_WITH_PARAMS +INSTANTIATE_TEST_CASE_P(TDMHwcParams, + TDMHwc, + Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE))); +#else +INSTANTIATE_TEST_CASE_P(TDMHwcParams, + TDMHwc, + Values(TDM_DEFAULT_MODULE)); +#endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/haltests/src/tc_tdm_hwc_window.cpp b/haltests/src/tc_tdm_hwc_window.cpp index 3af1f35..b330e85 100644 --- a/haltests/src/tc_tdm_hwc_window.cpp +++ b/haltests/src/tc_tdm_hwc_window.cpp @@ -40,50 +40,23 @@ public: TDMHwcWindow(); void SetUp(void); void TearDown(void); - - tdm_error error; - tdm_hwc_window **hwc_wins; - int hwc_count; }; TDMHwcWindow::TDMHwcWindow() { - error = TDM_ERROR_NONE; - hwc_wins = NULL; - hwc_count = 0; - video_hwc_win = NULL; } void TDMHwcWindow::SetUp(void) { - tdm_hwc_window *hw = NULL; - TDMOutput::SetUp(); - - hwc_wins = (tdm_hwc_window **)calloc(output_count * HWC_WIN_NUM, sizeof(tdm_hwc_window *)); - - //create HWC_WIN_NUM hwc_windows for each outputs - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - for (int w = 0; w < HWC_WIN_NUM; w++) { - hw = tdm_hwc_create_window(outputs[w], &error); - ASSERT_EQ(TDM_ERROR_NONE, error); - hwc_wins[hwc_count++] = hw; - } - } - } } void TDMHwcWindow::TearDown(void) { - for (int w = 0; w < hwc_count; w++) - tdm_hwc_window_destroy(hwc_wins[w]); - TDMOutput::TearDown(); } -/* void tdm_hwc_window_destroy(tdm_hwc_window *hwc_window); */ -/* +/* void tdm_hwc_window_destroy() */ TEST_P(TDMHwcWindow, DestroyWindowFailNull) { tdm_hwc_window_destroy(NULL); @@ -93,24 +66,27 @@ TEST_P(TDMHwcWindow, DestroyWindowSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_error error = TDM_ERROR_NONE; tdm_hwc_window *hw = NULL; for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - hw = tdm_hwc_create_window(outputs[o], &error); - ASSERT_EQ(TDM_ERROR_NONE, error); - error = tdm_hwc_window_destroy(outputs[o], hw); + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hw = tdm_hwc_create_window(hwc, &error); ASSERT_EQ(TDM_ERROR_NONE, error); + if (hw) + tdm_hwc_window_destroy(hw); } } } -*/ -/* tbm_surface_queue_h tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error); */ +/* tbm_surface_queue_h tdm_hwc_window_get_buffer_queue() */ TEST_P(TDMHwcWindow, GetBufferQueueFailNull) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_error error = TDM_ERROR_NONE; tbm_surface_queue_h queue = NULL; queue = tdm_hwc_window_get_buffer_queue(NULL, &error); @@ -125,27 +101,44 @@ TEST_P(TDMHwcWindow, GetBufferQueueSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_wins[HWC_WIN_NUM]; + tdm_error error = TDM_ERROR_NONE; + int w; tbm_surface_queue_h queue = NULL; tdm_hwc_window_info info = { 0 }; - info.src_config.format = TBM_FORMAT_ARGB8888; - info.src_config.size.h = info.src_config.size.v = 256; - info.src_config.pos.h = info.src_config.pos.w = 256; - info.dst_pos.h = info.dst_pos.w = 256; - info.transform = TDM_TRANSFORM_NORMAL; + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + for (w = 0; w < HWC_WIN_NUM; w++) { + hwc_wins[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_wins[w]); + } + + info.src_config.format = TBM_FORMAT_ARGB8888; + info.src_config.size.h = info.src_config.size.v = 256; + info.src_config.pos.h = info.src_config.pos.w = 256; + info.dst_pos.h = info.dst_pos.w = 256; + info.transform = TDM_TRANSFORM_NORMAL; - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_info(hwc_wins[w], &info); - ASSERT_EQ(TDM_ERROR_NONE, error); + for (w = 0; w < HWC_WIN_NUM; w++) { + error = tdm_hwc_window_set_info(hwc_wins[w], &info); + ASSERT_EQ(TDM_ERROR_NONE, error); - queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], &error); - tbm_surface_queue_destroy(queue); - ASSERT_EQ(TDM_ERROR_NONE, error); - ASSERT_NE(NULL, queue); + queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], &error); + tbm_surface_queue_destroy(queue); + ASSERT_EQ(TDM_ERROR_NONE, error); + ASSERT_NE(NULL, queue); - queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], NULL); - tbm_surface_queue_destroy(queue); - ASSERT_NE(NULL, queue); + queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], NULL); + tbm_surface_queue_destroy(queue); + ASSERT_NE(NULL, queue); + } + + for (w = 0; w < HWC_WIN_NUM; w++) + tdm_hwc_window_destroy(hwc_wins[w]); + } } } @@ -155,39 +148,70 @@ TEST_P(TDMHwcWindow, SetCompositionTypeFailNull) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_error error = TDM_ERROR_NONE; + error = tdm_hwc_window_set_composition_type(NULL, TDM_COMPOSITION_DEVICE); ASSERT_NE(TDM_ERROR_NONE, error); } -TEST_P(TDMHwcWindow, SetCompositionTypeSuccessful) +TEST_P(TDMHwcWindow, SetCompositionTypeFailInvalieCompositionType) { TDM_UT_SKIP_FLAG(has_outputs); - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_DEVICE); - ASSERT_EQ(TDM_ERROR_NONE, error); - error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CLIENT); - ASSERT_EQ(TDM_ERROR_NONE, error); - error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CURSOR); - ASSERT_EQ(TDM_ERROR_NONE, error); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_set_composition_type(hwc_win, tdm_hwc_window_composition(TDM_COMPOSITION_NONE - 1)); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } } } -TEST_P(TDMHwcWindow, SetCompositionTypeFailInvalieCompositionType) +TEST_P(TDMHwcWindow, SetCompositionTypeSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_composition_type(hwc_wins[w], tdm_hwc_window_composition(TDM_COMPOSITION_NONE - 1)); - ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_wins[HWC_WIN_NUM]; + tdm_error error = TDM_ERROR_NONE; + int w; + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + for (w = 0; w < HWC_WIN_NUM; w++) { + hwc_wins[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_wins[w]); + } + + for (w = 0; w < HWC_WIN_NUM; w++) { + error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_DEVICE); + ASSERT_EQ(TDM_ERROR_NONE, error); + error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CLIENT); + ASSERT_EQ(TDM_ERROR_NONE, error); + error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CURSOR); + ASSERT_EQ(TDM_ERROR_NONE, error); + } + + for (w = 0; w < HWC_WIN_NUM; w++) + tdm_hwc_window_destroy(hwc_wins[w]); + } } } -/* tdm_error tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage); */ +/* tdm_error tdm_hwc_window_set_buffer_damage() */ TEST_P(TDMHwcWindow, SetBufferDamageFailNullHwcWindow) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_error error = TDM_ERROR_NONE; tdm_region damage = {.num_rects = 0, .rects = NULL}; error = tdm_hwc_window_set_buffer_damage(NULL, damage); @@ -198,42 +222,69 @@ TEST_P(TDMHwcWindow, SetBufferDamageFailNullDamageRects) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_region damage = {.num_rects = 1, .rects = NULL}; - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage); - ASSERT_NE(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_set_buffer_damage(hwc_win, damage); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } } } - TEST_P(TDMHwcWindow, SetBufferDamageSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_wins[HWC_WIN_NUM]; + tdm_error error = TDM_ERROR_NONE; tdm_pos const rects[1] = {0}; tdm_region damage = {.num_rects = 1, .rects = rects}; - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage); - ASSERT_EQ(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + for (int w = 0; w < HWC_WIN_NUM; w++) { + hwc_wins[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_wins[w]); + error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage); + ASSERT_EQ(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_wins[w]); + } + } } } - -/* tdm_error tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info); */ +/* tdm_error tdm_hwc_window_set_info() */ TEST_P(TDMHwcWindow, SetInfoFailNull) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_hwc_window_info info = { 0 }; error = tdm_hwc_window_set_info(NULL, &info); ASSERT_NE(TDM_ERROR_NONE, error); - if (hwc_count > 0) { - error = tdm_hwc_window_set_info(hwc_wins[0], NULL); - ASSERT_NE(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_set_info(hwc_win, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } } } @@ -241,20 +292,30 @@ TEST_P(TDMHwcWindow, SetInfoSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_hwc_window_info info = { 0 }; - for (int w = 0; w < hwc_count; w++) { - error = tdm_hwc_window_set_info(hwc_wins[w], &info); - ASSERT_EQ(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_set_info(hwc_win, &info); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } } } - -/* tdm_error tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer); */ +/* tdm_error tdm_hwc_window_set_buffer() */ TEST_P(TDMHwcWindow, SetBufferFailNull) { TDM_UT_SKIP_FLAG(has_outputs); + tdm_error error = TDM_ERROR_NONE; + error = tdm_hwc_window_set_buffer(NULL, NULL); ASSERT_NE(TDM_ERROR_NONE, error); } @@ -263,106 +324,116 @@ TEST_P(TDMHwcWindow, SetBufferSuccessful) { TDM_UT_SKIP_FLAG(has_outputs); - for (int w = 0; w < hwc_count; w++) { + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_wins[HWC_WIN_NUM]; + tdm_error error = TDM_ERROR_NONE; + tbm_surface_h buffer = NULL; - tbm_surface_h buff = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888); - - /* test: set*/ - error = tdm_hwc_window_set_buffer(hwc_wins[w], buff); - tbm_surface_destroy(buff); - ASSERT_EQ(TDM_ERROR_NONE, error); - - /* test: reset*/ - error = tdm_hwc_window_set_buffer(hwc_wins[w], NULL); - ASSERT_EQ(TDM_ERROR_NONE, error); - } -} - -/* tdm_hwc_get_available_properties() */ -/* -TEST_P(TDMHwcWindow, GetAvailablePropertiesFailNullWin) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); - const tdm_prop *props; - int count; - - error = tdm_hwc_get_available_properties(NULL, &props, &count); - ASSERT_NE(TDM_ERROR_NONE, error); - - error = tdm_hwc_get_available_properties(video_hwc_win, NULL, &count); - ASSERT_NE(TDM_ERROR_NONE, error); - - error = tdm_hwc_get_available_properties(video_hwc_win, &props, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); -} + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + for (int w = 0; w < HWC_WIN_NUM; w++) { + hwc_wins[w] = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_wins[w]); -TEST_P(TDMHwcWindow, GetAvailablePropertiesSuccess) -{ - TDM_UT_SKIP_FLAG(has_outputs); + buffer = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888); + ASSERT_NE(NULL, buffer); - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); + error = tdm_hwc_window_set_buffer(hwc_wins[w], buffer); + tbm_surface_destroy(buffer); + ASSERT_EQ(TDM_ERROR_NONE, error); - const tdm_prop *props; - int count; + /* set NULL to the buffer */ + error = tdm_hwc_window_set_buffer(hwc_wins[w], NULL); + ASSERT_EQ(TDM_ERROR_NONE, error); - error = tdm_hwc_get_available_properties(video_hwc_win, &props, &count); - ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error); + tdm_hwc_window_destroy(hwc_wins[w]); + } + } + } } -*/ -/* tdm_hwc_window_get_property() */ -TEST_P(TDMHwcWindow, GetPropertyFailNull) +/* tdm_hwc_window_set_property() */ +TEST_P(TDMHwcWindow, SetPropertyFailNull) { TDM_UT_SKIP_FLAG(has_outputs); - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); + tdm_error error = TDM_ERROR_NONE; tdm_value value; int id = 1; - error = tdm_hwc_window_get_property(NULL, id, &value); - ASSERT_NE(TDM_ERROR_NONE, error); - - error = tdm_hwc_window_get_property(video_hwc_win, id, NULL); + error = tdm_hwc_window_set_property(NULL, id, value); ASSERT_NE(TDM_ERROR_NONE, error); } -TEST_P(TDMHwcWindow, GetPropertyFailWrongId) +TEST_P(TDMHwcWindow, SetPropertyFailWrongId) { TDM_UT_SKIP_FLAG(has_outputs); - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_value value; int id = INT_MAX; - error = tdm_hwc_window_get_property(video_hwc_win, id, &value); - ASSERT_NE(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_set_property(hwc_win, id, value); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } + } } -/* tdm_hwc_window_set_property() */ -TEST_P(TDMHwcWindow, SetPropertyFailNull) +/* tdm_hwc_window_get_property() */ +TEST_P(TDMHwcWindow, GetPropertyFailNull) { TDM_UT_SKIP_FLAG(has_outputs); - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_value value; int id = 1; - error = tdm_hwc_window_set_property(NULL, id, value); + error = tdm_hwc_window_get_property(NULL, id, &value); ASSERT_NE(TDM_ERROR_NONE, error); + + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_get_property(hwc_win, id, NULL); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } + } } -TEST_P(TDMHwcWindow, SetPropertyFailWrongId) +TEST_P(TDMHwcWindow, GetPropertyFailWrongId) { TDM_UT_SKIP_FLAG(has_outputs); - TDM_UT_SKIP_FLAG(video_hwc_win != NULL); + tdm_hwc *hwc = NULL; + tdm_hwc_window *hwc_win; + tdm_error error = TDM_ERROR_NONE; tdm_value value; int id = INT_MAX; - error = tdm_hwc_window_set_property(video_hwc_win, id, value); - ASSERT_NE(TDM_ERROR_NONE, error); + for (int o = 0; o < output_count; o++) { + hwc = tdm_output_get_hwc(hwc, &error); + if (hwc) { + hwc_win = tdm_hwc_create_window(hwc, &error); + ASSERT_NE(NULL, hwc_win); + error = tdm_hwc_window_get_property(hwc_win, id, &value); + ASSERT_NE(TDM_ERROR_NONE, error); + tdm_hwc_window_destroy(hwc_win); + } + } } #ifdef TDM_UT_TEST_WITH_PARAMS diff --git a/haltests/src/tc_tdm_output_hwc.cpp b/haltests/src/tc_tdm_output_hwc.cpp deleted file mode 100644 index 3a6ca4d..0000000 --- a/haltests/src/tc_tdm_output_hwc.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/************************************************************************** - * - * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved. - * - * Contact: Konstantin Drabeniuk - * Contact: Andrii Sokolenko - * Contact: Roman Marchenko - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * -**************************************************************************/ - -#include "tc_tdm.h" - -/* LCOV_EXCL_START */ - -class TDMOutputHwc : public TDMOutput -{ -public: - TDMOutputHwc(); - void SetUp(void); - void TearDown(void); - - tdm_error error; -}; - -TDMOutputHwc::TDMOutputHwc() -{ - error = TDM_ERROR_NONE; -} - -void TDMOutputHwc::SetUp(void) -{ - TDMOutput::SetUp(); -} - -void TDMOutputHwc::TearDown(void) -{ - TDMOutput::TearDown(); -} - -/* tdm_hwc_window * tdm_hwc_create_window(tdm_output *output, tdm_error *error); */ -TEST_P(TDMOutputHwc, CreateWindowFailNull) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - ASSERT_EQ(NULL, tdm_hwc_create_window(NULL, &error)); - ASSERT_NE(TDM_ERROR_NONE, error); -} - -/* -TEST_P(TDMOutputHwc, CreateWindowSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_hwc_window * hw = NULL; - - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - hw = tdm_hwc_create_window(hwc[o], &error); - ASSERT_EQ(TDM_ERROR_NONE, error); - tdm_hwc_window_destroy(hw); - } else { - ASSERT_EQ(NULL, tdm_hwc_create_window(outputs[o], &error)); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} -*/ - -/* tdm_error tdm_hwc_set_client_target_buffer(tdm_output *output, - tbm_surface_h target_buffer, tdm_region damage, - tdm_hwc_window *composited_wnds, uint32_t num_wnds); */ -/* TDOO: need to be fixed -TEST_P(TDMOutputHwc, SetClientTargetBufferFailNullOutput) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_region reg; - tbm_surface_h target_buff = CreateBufferForOutput(0); - error = tdm_hwc_set_client_target_buffer(NULL, target_buff, reg, NULL, 0 ); - tbm_surface_internal_destroy(target_buff); - ASSERT_NE(TDM_ERROR_NONE, error); -} - -TEST_P(TDMOutputHwc, SetClientTargetBufferFailNoHwc) -{ - tdm_region damage = {.num_rects = 0, .rects = NULL}; - - for (int o = 0; o < output_count; o++) { - tbm_surface_h target_buff = CreateBufferForOutput(i); - ASSERT_NE(NULL, target_buff); - error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage, NULL, 0); - tbm_surface_internal_destroy(target_buff); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} - -TEST_P(TDMOutputHwc, SetClientTargetBufferSuccessfulSetBuff) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_region damage = {.num_rects = 0, .rects = NULL}; - - for (int o = 0; o < output_count; o++) { - tbm_surface_h target_buff = CreateBufferForOutput(i); - ASSERT_NE(NULL, target_buff); - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage, - NULL, 0); - tbm_surface_internal_destroy(target_buff); - ASSERT_EQ(TDM_ERROR_NONE, error); - } else { - error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage, - NULL, 0); - tbm_surface_internal_destroy(target_buff); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} - -TEST_P(TDMOutputHwc, SetClientTargetBufferSuccessfulResetBuff) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_region damage = {.num_rects = 0, .rects = NULL}; - - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_set_client_target_buffer(outputs[o], NULL, damage, - NULL, 0); - ASSERT_EQ(TDM_ERROR_NONE, error); - } else { - error = tdm_hwc_set_client_target_buffer(outputs[o], NULL, damage, - NULL, 0); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} -*/ - -/* tbm_surface_queue_h tdm_hwc_get_client_target_buffer_queue(tdm_output *output, tdm_error *error); */ -/* -TEST_P(TDMOutputHwc, GetTargetBufferQueueFailNullObject) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tbm_surface_queue_h queue = NULL; - - queue = tdm_hwc_get_client_target_buffer_queue(NULL, &error); - ASSERT_NE(TDM_ERROR_NONE, error); - ASSERT_EQ(NULL, queue); - - queue = tdm_hwc_get_client_target_buffer_queue(NULL, NULL); - ASSERT_EQ(NULL, queue); -} - -TEST_P(TDMOutputHwc, GetTargetBufferQueueFainNoHwc) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tbm_surface_queue_h queue = NULL; - - for (int o = 0; o < output_count; o++) { - queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error); - ASSERT_NE(TDM_ERROR_NONE, error); - ASSERT_EQ(NULL, queue); - } -} -*/ - -TEST_P(TDMOutputHwc, GetTargetBufferQueueSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tbm_surface_queue_h queue = NULL; - - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error); - tbm_surface_queue_destroy(queue); - ASSERT_EQ(TDM_ERROR_NONE, error); - ASSERT_NE(NULL, queue); - - queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], NULL); - tbm_surface_queue_destroy(queue); - ASSERT_EQ(TDM_ERROR_NONE, error); - ASSERT_NE(NULL, queue); - } else { - queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error); - ASSERT_NE(TDM_ERROR_NONE, error); - ASSERT_EQ(NULL, queue); - - queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - ASSERT_EQ(NULL, queue); - } - } -} - -/* tdm_error tdm_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds, - uint32_t *num_types); */ -/* TODO: fix the validate test later. -TEST_P(TDMOutputHwc, ValidateFailNull) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t num_types; - error = tdm_hwc_validate(NULL, NULL, 0, &num_types); - ASSERT_NE(TDM_ERROR_NONE, error); - - if (outputs[0]) { - error = tdm_hwc_validate(outputs[0], NULL, 0, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} - -TEST_P(TDMOutputHwc, ValidateFailNoHwc) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t num_types; - - for (int o = 0; o < output_count; o++) { - error = tdm_hwc_validate(outputs[o], &num_types); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} - -TEST_P(TDMOutputHwc, ValidateSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t num_types; - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_validate(outputs[o], &num_types); - ASSERT_EQ(TDM_ERROR_NONE, error); - } else { - error = tdm_hwc_validate(outputs[o], &num_types); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} -TODO: */ - -/* tdm_error tdm_hwc_get_changed_composition_types(tdm_hwc *hwc, - uint32_t *num_elements, tdm_hwc_window **hwc_window, - tdm_hwc_window_composition *composition_types); */ -/* -TEST_P(TDMOutputHwc, GetChangedCompositionTypesFailNull) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t num_elements; - - error = tdm_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - - if (outputs[0]) { - error = tdm_hwc_get_changed_composition_types(outputs[0], NULL, NULL, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} - -TEST_P(TDMOutputHwc, GetChangedCompositionTypesFailNoHwc) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t get_num = 10; - - for (int o = 0; o < output_count; o++) { - error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} -*/ -/* TODO: fix the validate test later. -TEST_P(TDMHwcWindow, GetChangedCompositionTypesSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t validate_num; - uint32_t get_num = 0; - - tdm_hwc_window_composition *composition_types; - tdm_hwc_window **hwc_wnds; - - for (int i = 0; i < hwc_count; i++) { - error = tdm_hwc_window_set_composition_type(hwc_wins[o], TDM_COMPOSITION_DEVICE); - ASSERT_EQ(TDM_ERROR_NONE, error); - } - - - for (int i = 0; i < output_count; i++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_validate(outputs[o], &validate_num); - ASSERT_EQ(TDM_ERROR_NONE, error); - - error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL); - ASSERT_EQ(TDM_ERROR_NONE, error); - - ASSERT_EQ(get_num, validate_num); - hwc_wnds = (tdm_hwc_window **)calloc(get_num, sizeof(tdm_hwc_window *)); - composition_types = (tdm_hwc_window_composition *)calloc(get_num, sizeof(tdm_hwc_window_composition)); - - error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, hwc_wnds, composition_types); - - free(hwc_wnds); - free(composition_types); - - ASSERT_EQ(TDM_ERROR_NONE, error); - } else { - error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} -*/ - -/* tdm_error tdm_hwc_accept_changes(tdm_hwc *hwc); */ -/* -TEST_P(TDMOutputHwc, AcceptChangesFailNull) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - error = tdm_hwc_accept_changes(NULL); - ASSERT_NE(TDM_ERROR_NONE, error); -} - -TEST_P(TDMOutputHwc, AcceptChangesFailNoHwc) -{ - for (int o = 0; o < output_count; o++) { - error = tdm_hwc_accept_changes(outputs[o]); - ASSERT_NE(TDM_ERROR_NONE, error); - } -} -*/ -/* TODO: fix the validate test later. -TEST_P(TDMHwcWindow, AcceptChangesSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - uint32_t validate_num; - - for (int i = 0; i < hwc_count; i++) { - error = tdm_hwc_window_set_composition_type(hwc_wins[o], TDM_COMPOSITION_DEVICE); - ASSERT_EQ(TDM_ERROR_NONE, error); - } - - for (int i = 0; i < output_count; i++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_validate(outputs[o], &validate_num); - ASSERT_EQ(TDM_ERROR_NONE, error); - - if (validate_num > 0) { - error = tdm_hwc_accept_changes(outputs[o]); - ASSERT_EQ(TDM_ERROR_NONE, error); - } - } - } -} -*/ - -/* tdm_hwc_get_supported_formats() */ -/* -TEST_P(TDMOutputHwc, GetVideoSupportedFormatsFailNull) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_error error; - - error = tdm_hwc_get_supported_formats(NULL, NULL, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); -} - -TEST_P(TDMOutputHwc, GetVideoSupportedFormatsSuccessful) -{ - TDM_UT_SKIP_FLAG(has_outputs); - - tdm_error error; - const tbm_format *formats; - int count; - - for (int o = 0; o < output_count; o++) { - if (tc_tdm_output_is_hwc_enable(outputs[o])) { - error = tdm_hwc_get_supported_formats(outputs[o], &formats, &count); - if (error != TDM_ERROR_NOT_IMPLEMENTED) { - ASSERT_EQ(TDM_ERROR_NONE, error); - if (count > 0) - ASSERT_NE(NULL, formats); - } - } else { - error = tdm_hwc_get_supported_formats(outputs[o], &formats, &count); - ASSERT_NE(TDM_ERROR_NONE, error); - } - } -} -*/ - -#ifdef TDM_UT_TEST_WITH_PARAMS -INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams, - TDMOutputHwc, - Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE))); -#else -INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams, - TDMOutputHwc, - Values(TDM_DEFAULT_MODULE)); -#endif - -/* LCOV_EXCL_END */ \ No newline at end of file -- 2.7.4 From a4b8dac3dca041874b9890b7a79d367f100aa79a Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 25 Jun 2018 15:23:06 +0900 Subject: [PATCH 06/16] vblank: avoid mutex lock error. Change-Id: I4c47966a7b6bb2afab62ed51ed2f06fa097b58c7 Signed-off-by: Junkyeong Kim --- src/tdm_vblank.c | 74 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/src/tdm_vblank.c b/src/tdm_vblank.c index b461a5b..568605a 100644 --- a/src/tdm_vblank.c +++ b/src/tdm_vblank.c @@ -450,6 +450,45 @@ _tdm_vblank_cb_output_change(tdm_output *output, tdm_output_change_type type, } /* LCOV_EXCL_STOP */ +static tdm_error +_tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps) +{ + tdm_private_vblank *private_vblank = vblank; + + if (private_vblank->fps_fixed) { + VIN("fps(%u) can't be changed", private_vblank->fps); + return TDM_ERROR_NONE; + } + + private_vblank->fps_changeable = 0; + + if (private_vblank->fps == fps) + return TDM_ERROR_NONE; + + private_vblank->fps = fps; + private_vblank->check_HW_or_SW = 1; + + VIN("fps(%u) changed", fps); + + return TDM_ERROR_NONE; +} + +static tdm_error +_tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore) +{ + tdm_private_vblank *private_vblank = vblank; + + if (private_vblank->ignore_global_fps == ignore) + return TDM_ERROR_NONE; + + private_vblank->ignore_global_fps = ignore; + private_vblank->check_HW_or_SW = 1; + + VIN("ignore_global_fps(%u)", private_vblank->ignore_global_fps); + + return TDM_ERROR_NONE; +} + EXTERN tdm_error tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned int fps) { @@ -483,7 +522,7 @@ tdm_vblank_set_client_vblank_fps(unsigned int pid, const char *name, unsigned in continue; } - ret = tdm_vblank_set_fps(v, fps); + ret = _tdm_vblank_set_fps(v, fps); if (ret == TDM_ERROR_NONE) TDM_INFO("(pid:%u) '%s' fps changed: %d", pid, v->name, fps); else @@ -526,7 +565,7 @@ tdm_vblank_set_client_ignore_global_fps(unsigned int pid, const char *name, unsi continue; } - ret = tdm_vblank_ignore_global_fps(v, ignore); + ret = _tdm_vblank_ignore_global_fps(v, ignore); if (ret == TDM_ERROR_NONE) TDM_INFO("(pid:%u) '%s' ignore changed: %u", pid, v->name, ignore); else @@ -909,27 +948,10 @@ tdm_vblank_get_name(tdm_vblank *vblank, const char **name) EXTERN tdm_error tdm_vblank_set_fps(tdm_vblank *vblank, unsigned int fps) { - tdm_private_vblank *private_vblank = vblank; - TDM_RETURN_VAL_IF_FAIL(tdm_vblank_is_valid(vblank), TDM_ERROR_INVALID_PARAMETER); TDM_RETURN_VAL_IF_FAIL(fps > 0, TDM_ERROR_INVALID_PARAMETER); - if (private_vblank->fps_fixed) { - VIN("fps(%u) can't be changed", private_vblank->fps); - return TDM_ERROR_NONE; - } - - private_vblank->fps_changeable = 0; - - if (private_vblank->fps == fps) - return TDM_ERROR_NONE; - - private_vblank->fps = fps; - private_vblank->check_HW_or_SW = 1; - - VIN("fps(%u) changed", fps); - - return TDM_ERROR_NONE; + return _tdm_vblank_set_fps(vblank, fps); } EXTERN tdm_error @@ -970,19 +992,9 @@ tdm_vblank_set_fixed_fps(tdm_vblank *vblank, unsigned int fps) EXTERN tdm_error tdm_vblank_ignore_global_fps(tdm_vblank *vblank, unsigned int ignore) { - tdm_private_vblank *private_vblank = vblank; - TDM_RETURN_VAL_IF_FAIL(tdm_vblank_is_valid(vblank), TDM_ERROR_INVALID_PARAMETER); - if (private_vblank->ignore_global_fps == ignore) - return TDM_ERROR_NONE; - - private_vblank->ignore_global_fps = ignore; - private_vblank->check_HW_or_SW = 1; - - VIN("ignore_global_fps(%u)", private_vblank->ignore_global_fps); - - return TDM_ERROR_NONE; + return _tdm_vblank_ignore_global_fps(vblank, ignore); } EXTERN tdm_error -- 2.7.4 From 60ea919f68912ac1fec69f1f78d743a055970b42 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 24 May 2018 15:51:30 +0900 Subject: [PATCH 07/16] common: remove unused code Change-Id: Ie8e04d4d398e71f9152f709f57e8c28f74ae10a3 --- src/tdm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index 6f938ec..6886527 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -1035,10 +1035,6 @@ tdm_display_init(tdm_error *error) start = stamp1 = tdm_helper_get_time(); - stamp2 = tdm_helper_get_time(); - TDM_INFO("config init time: %.3f ms", (stamp2 - stamp1) * 1000.0); - stamp1 = stamp2; - private_display = calloc(1, sizeof(tdm_private_display)); if (!private_display) { /* LCOV_EXCL_START */ -- 2.7.4 From 189e36e48cb23005aac962500813fbbf7a0e3a1a Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 27 Jun 2018 11:18:16 +0900 Subject: [PATCH 08/16] log: check tdm environment value only init Change-Id: I46425da547cc57edc7163d4838e49f92b7ad607a Signed-off-by: Junkyeong Kim --- common/tdm_log.c | 9 --------- include/tdm_log.h | 1 - src/tdm_config.c | 27 ++++++++++++++++++++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/common/tdm_log.c b/common/tdm_log.c index ac7666d..975eb19 100644 --- a/common/tdm_log.c +++ b/common/tdm_log.c @@ -81,9 +81,6 @@ tdm_log_enable_color(unsigned int enable) EXTERN void tdm_log_enable_dlog(unsigned int enable) { - const char *str = getenv("TDM_DLOG"); - if (str) - enable = (str[0] == '1') ? 1 : 0; dlog_enable = enable; TDM_INFO("dlog_enable: %d", dlog_enable); } @@ -91,9 +88,6 @@ tdm_log_enable_dlog(unsigned int enable) EXTERN void tdm_log_set_debug_level(int level) { - const char *str = getenv("TDM_DEBUG_LEVEL"); - if (str) - level = str[0] - '0'; tdm_log_debug_level = level; TDM_INFO("debug_level: %d", tdm_log_debug_level); } @@ -101,9 +95,6 @@ tdm_log_set_debug_level(int level) EXTERN void tdm_log_set_assert_level(int level) { - const char *str = getenv("TDM_ASSERT_LEVEL"); - if (str) - level = str[0] - '0'; assert_level = level; TDM_INFO("assert_level: %d", assert_level); } diff --git a/include/tdm_log.h b/include/tdm_log.h index f1b3cdc..de56386 100644 --- a/include/tdm_log.h +++ b/include/tdm_log.h @@ -71,7 +71,6 @@ void tdm_log_set_assert_level(int level); void tdm_log_set_path(const char *path); void tdm_log_printf(int level, const char *fmt, ...); void tdm_log_print(int level, const char *fmt, ...); - void tdm_log_reset(void); extern unsigned int tdm_log_debug_level; diff --git a/src/tdm_config.c b/src/tdm_config.c index 9918fa4..95f5119 100644 --- a/src/tdm_config.c +++ b/src/tdm_config.c @@ -104,10 +104,24 @@ _tdm_config_check_logs(void) pthread_mutex_unlock(&g_dic_lock); - level = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_LOG_LEVEL, 3); + level = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_LOG_LEVEL, -1); + if (level == -1) { + const char *str = getenv("TDM_DEBUG_LEVEL"); + if (str) + level = str[0] - '0'; + else + level = 3; + } tdm_log_set_debug_level(level); - level = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_ASSERT_LEVEL, 0); + level = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_ASSERT_LEVEL, -1); + if (level == -1) { + const char *str = getenv("TDM_ASSERT_LEVEL"); + if (str) + level = str[0] - '0'; + else + level = 0; + } tdm_log_set_assert_level(level); /* if TDM_CONFIG_KEY_DEBUG_LOG_PATH is setted, TDM_CONFIG_KEY_DEBUG_DLOG will be ignored. */ @@ -116,7 +130,14 @@ _tdm_config_check_logs(void) tdm_log_enable_dlog(0); tdm_log_set_path(path); } else { - int dlog = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_DLOG, 1); + int dlog = tdm_config_get_int(TDM_CONFIG_KEY_DEBUG_DLOG, -1); + if (dlog == -1) { + const char *str = getenv("TDM_DLOG"); + if (str) + dlog = (str[0] == '1') ? 1 : 0; + else + dlog = 1; + } tdm_log_enable_dlog(dlog); } -- 2.7.4 From 096b0daf780ac2cf91e64aab37f640241eb4f632 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 27 Jun 2018 11:45:31 +0900 Subject: [PATCH 09/16] package version up to 2.0.1 Change-Id: I20d6523c147ccb75f67e6149e7619e1a64baddc7 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 5bcae43..d6ac6e3 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.0.0 +Version: 2.0.1 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From b587c76b5319d00f0c1305ce91053c1fe97c42ca Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 18 Jul 2018 19:36:20 +0900 Subject: [PATCH 10/16] fixed wrong checking abi version of module if minor version of module less than minimum minor version, func return false even if major version greater than minimum major version. so patch fixed it Change-Id: I6bb6a9dc7d46d4b6e949577f01d5bb443bc99b49 --- src/tdm_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tdm_display.c b/src/tdm_display.c index 45ccdf2..297dd70 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -850,6 +850,9 @@ tdm_module_check_abi(tdm_private_module *private_module, int abimaj, int abimin) { tdm_backend_module *module = private_module->module_data; + if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) > abimaj) + return 1; + if (TDM_BACKEND_GET_ABI_MAJOR(module->abi_version) < abimaj) return 0; -- 2.7.4 From ea1b2719641483fb39742f3bbe298cf6fd1328ee Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 19 Jul 2018 20:19:05 +0900 Subject: [PATCH 11/16] remove unused tdm_hwc_window_composition Change-Id: I4eb2aa45ee7d06ffd6c851cdb8bd7c3701e5e2df --- include/tdm_types.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/tdm_types.h b/include/tdm_types.h index 32f544d..1a494f6 100644 --- a/include/tdm_types.h +++ b/include/tdm_types.h @@ -177,12 +177,6 @@ typedef enum { */ TDM_COMPOSITION_CLIENT = 1, - /** Set by the client before tdm_hwc_validate(). - * - * Upon tdm_hwc_validate(), the device may request a change from this type to - * TDM_COMPOSITION_DEVICE or TDM_COMPOSITION_CLIENT. */ - TDM_COMPOSITION_DEVICE_CANDIDATE = 2, - /** Set by the HWC after tdm_hwc_validate(). * * The device will handle the composition of this window through a hardware -- 2.7.4 From c2c11e87d1af1106ab783ed7b4b984dd0667d58e Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 19 Jul 2018 20:18:20 +0900 Subject: [PATCH 12/16] rename tdm_hwc_get_video_supported_formats Change-Id: I9034c4f898c7753e81790c02d7e71511651ad527 --- haltests/src/tc_tdm_hwc.cpp | 6 +++--- include/tdm.h | 7 ++++--- include/tdm_backend.h | 4 ++-- src/tdm_hwc.c | 6 +++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/haltests/src/tc_tdm_hwc.cpp b/haltests/src/tc_tdm_hwc.cpp index 545c6a0..4df9e54 100644 --- a/haltests/src/tc_tdm_hwc.cpp +++ b/haltests/src/tc_tdm_hwc.cpp @@ -106,7 +106,7 @@ TEST_P(TDMHwc, GetSupportedFormatsFailNull) tdm_error error; - error = tdm_hwc_get_supported_formats(NULL, NULL, NULL); + error = tdm_hwc_get_video_supported_formats(NULL, NULL, NULL); ASSERT_NE(TDM_ERROR_NONE, error); } @@ -122,14 +122,14 @@ TEST_P(TDMHwc, GetSupportedFormatsSuccessful) for (int o = 0; o < output_count; o++) { hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { - error = tdm_hwc_get_supported_formats(hwc, &formats, &count); + error = tdm_hwc_get_video_supported_formats(hwc, &formats, &count); if (error != TDM_ERROR_NOT_IMPLEMENTED) { ASSERT_EQ(TDM_ERROR_NONE, error); if (count > 0) ASSERT_NE(NULL, formats); } } else { - error = tdm_hwc_get_supported_formats(hwc, &formats, &count); + error = tdm_hwc_get_video_supported_formats(hwc, &formats, &count); ASSERT_NE(TDM_ERROR_NONE, error); } } diff --git a/include/tdm.h b/include/tdm.h index 7beccd0..1568ea1 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -825,14 +825,15 @@ tdm_hwc_window * tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error); /** - * @brief Get the supported format array for hwc windows of a hwc object. - * @param[in] hwc A output hwc + * @brief Get the video supported format array for hwc windows of a output object. + * @param[in] hwc A hwc object * @param[out] formats The available format array * @param[out] count The count of formats * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error -tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count); +tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, + int *count); /** * @brief Get the available property array of a hwc object. diff --git a/include/tdm_backend.h b/include/tdm_backend.h index e9fc70d..4949d1e 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -694,13 +694,13 @@ typedef struct _tdm_func_hwc { tdm_hwc_window *(*hwc_create_window)(tdm_hwc *hwc, tdm_error *error); /** - * @brief Get the supported format array for the hwc windows of a hwc object. + * @brief Get video the supported format array for the hwc windows of a hwc object. * @param[in] hwc A hwc object * @param[out] formats The available format array * @param[out] count The count of formats * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ - tdm_error (*hwc_get_supported_formats)(tdm_hwc *hwc, const tbm_format **formats, + tdm_error (*hwc_get_video_supported_formats)(tdm_hwc *hwc, const tbm_format **formats, int *count); diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index f7ed46f..b4df1c0 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -178,7 +178,7 @@ tdm_hwc_create_window(tdm_hwc *hwc, tdm_error *error) } EXTERN tdm_error -tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count) +tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count) { tdm_private_module *private_module; tdm_func_hwc *func_hwc; @@ -193,7 +193,7 @@ tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *cou private_module = private_output->private_module; func_hwc = &private_module->func_hwc; - if (!func_hwc->hwc_get_supported_formats) { + if (!func_hwc->hwc_get_video_supported_formats) { /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); @@ -201,7 +201,7 @@ tdm_hwc_get_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *cou /* LCOV_EXCL_STOP */ } - ret = func_hwc->hwc_get_supported_formats(private_hwc->hwc_backend, formats, count); + ret = func_hwc->hwc_get_video_supported_formats(private_hwc->hwc_backend, formats, count); _pthread_mutex_unlock(&private_display->lock); -- 2.7.4 From d83a8cb9702ec0084ffcaaefe561a7c20f030d15 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 19 Jul 2018 20:35:05 +0900 Subject: [PATCH 13/16] added tdm_hwc_get_video_capability Change-Id: I0bfff03716453a5e1b2b903bb55628e831c865dc --- include/tdm.h | 9 +++++++++ include/tdm_backend.h | 9 ++++++++- include/tdm_common.h | 10 ++++++++++ src/tdm_hwc.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/include/tdm.h b/include/tdm.h index 1568ea1..acd3a45 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -836,6 +836,15 @@ tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, int *count); /** + * @brief Get the hwc video capability + * @param[in] hwc A hwc object + * @param[out] video_capability A hwc video capability + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_get_video_capability(tdm_hwc *hwc, tdm_hwc_video_capability *video_capability); + +/** * @brief Get the available property array of a hwc object. * @param[in] hwc A hwc * @param[out] props The available property array diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 4949d1e..d614fff 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -702,7 +702,14 @@ typedef struct _tdm_func_hwc { */ tdm_error (*hwc_get_video_supported_formats)(tdm_hwc *hwc, const tbm_format **formats, int *count); - + /** + * @brief Get the hwc video capability + * @param[in] hwc A hwc object + * @param[out] video_capability A hwc hwc video capability + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_get_video_capability)(tdm_hwc *hwc, + tdm_hwc_video_capability *video_capability); /** * @brief Get the available property array of a hwc object. diff --git a/include/tdm_common.h b/include/tdm_common.h index 328f837..9492394 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -258,6 +258,16 @@ typedef enum { TDM_OUTPUT_MODE_FLAG_CLKDIV2 = (1 << 13), } tdm_output_mode_flag; +/* + * @brief The hwc video capability enumeration + * @since 2.0.0 + */ +typedef enum { + TDM_HWC_VIDEO_CAPABILITY_SCALE = (1 << 1), /**< if a hwc video has scale capability */ + TDM_HWC_VIDEO_CAPABILITY_TRANSFORM = (1 << 2), /**< if a hwc video has transform capability */ + TDM_HWC_VIDEO_CAPABILITY_SCANOUT = (1 << 3), /**< if a video allows a scanout buffer only */ +} tdm_hwc_video_capability; + /** * @brief The size structure */ diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index b4df1c0..49d4ca9 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -209,6 +209,34 @@ tdm_hwc_get_video_supported_formats(tdm_hwc *hwc, const tbm_format **formats, in } EXTERN tdm_error +tdm_hwc_get_video_capability(tdm_hwc *hwc, + tdm_hwc_video_capability *video_capability) +{ + tdm_private_module *private_module; + tdm_func_hwc *func_hwc; + + HWC_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_output->private_module; + func_hwc = &private_module->func_hwc; + + if (!func_hwc->hwc_get_video_capability) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc->hwc_get_video_capability(private_hwc->hwc_backend, + video_capability); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + +EXTERN tdm_error tdm_hwc_get_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count) { tdm_private_module *private_module; -- 2.7.4 From d47abbabf3332fcc8c410810f12216e79a25c459 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 24 Jul 2018 20:19:08 +0900 Subject: [PATCH 14/16] hwc_window: tdm_hwc_window_get_preparation_types Change-Id: I977b322aaedf140ea0aa58342867ab58a0f73dad --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 9 +++++++++ include/tdm_types.h | 10 ++++++++++ src/tdm_hwc_window.c | 27 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index acd3a45..fae9308 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1089,6 +1089,16 @@ tdm_error tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, uint32_t id, tdm_value value); /** + * @brief Get the preperation type of hwc_window + * @param[in] hwc window A hwc window object + * @param[out] preperation_types The tdm_hwc_window_preparation types + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_window_get_preparation_types(tdm_hwc_window *hwc_window, + int *preparation_types); + +/** * @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 d614fff..0b5829c 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -960,6 +960,15 @@ typedef struct _tdm_func_hwc_window { */ tdm_error (*hwc_window_get_property)(tdm_hwc_window *hwc_window, uint32_t id, tdm_value *value); + + /** + * @brief Get the preperation type of hwc_window + * @param[in] hwc window A hwc window object + * @param[out] preperation_types The tdm_hwc_window_preparation types + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_window_get_preparation_types)(tdm_hwc_window *hwc_window, + int *preperation_types); } tdm_func_hwc_window; /** diff --git a/include/tdm_types.h b/include/tdm_types.h index 1a494f6..c596ac6 100644 --- a/include/tdm_types.h +++ b/include/tdm_types.h @@ -205,6 +205,16 @@ typedef enum { TDM_COMPOSITION_VIDEO = 5, } tdm_hwc_window_composition; +typedef enum { + TDM_PREPARATION_NONE = 0, + /** If the client needs to render to a specific buffer for compositing + * with TDM_COMPOSITION_DEVICE, Set TDM_PREPARATION_BUFFER_QUEUE type to hwc_window. + * The client will render next frame on buffers of queue which got by + * tdm_hwc_window_get_buffer_queue. + */ + TDM_PREPARATION_BUFFER_QUEUE = (1 << 0), +} tdm_hwc_window_preparation; + /** * @brief The hwc window flag enumeration * @since 2.0.0 diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 78df88d..31e62ad 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -403,4 +403,31 @@ tdm_hwc_window_set_property(tdm_hwc_window *hwc_window, unsigned int id, tdm_val return ret; } + +EXTERN tdm_error +tdm_hwc_window_get_preparation_types(tdm_hwc_window *hwc_window, + int *preparation_types) +{ + tdm_private_module *private_module; + tdm_func_hwc_window *func_hwc_window = NULL; + + 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_get_preparation_types) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc_window->hwc_window_get_preparation_types(private_hwc_window->hwc_window_backend, preparation_types); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} /* LCOV_EXCL_STOP */ \ No newline at end of file -- 2.7.4 From dc0f94dbd2d214c19b3811ed424647906be77f75 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 24 Jul 2018 19:32:24 +0900 Subject: [PATCH 15/16] hwc_window: added tdm_hwc_window_free_buffer_queue Change-Id: I99775be1df445fe64039ba9f5c098b7e50fd005f --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 9 +++++++++ src/tdm_hwc_window.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index fae9308..0ec6055 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1004,6 +1004,16 @@ tbm_surface_queue_h tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error); /** + * @brief Free a buffer queue for the window object + * @details Free buffer queue when the client no longer uses buferrs of queue. + * @param[in] hwc_window A window object + * @param[in] A tbm buffer queue + * @since 2.0.0 + */ +void +tdm_hwc_window_free_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue); + +/** * @brief Sets the desired composition type of the given window. * @details During tdm_hwc_validate(), the device may request changes to * the composition types of any of the layers as described in the definition diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 0b5829c..52d9056 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -872,6 +872,15 @@ typedef struct _tdm_func_hwc_window { tdm_error *error); /** + * @brief Free a buffer queue for the window object + * @details Free buffer queue when the client no longer uses buferrs of queue. + * @param[in] hwc_window A window object + * @param[in] A tbm buffer queue + */ + void (*hwc_window_free_buffer_queue)(tdm_hwc_window *hwc_window, + tbm_surface_queue_h queue); + + /** * @brief Sets the desired composition type of the given window. * @details During hwc_validate(), the device may request changes to * the composition types of any of the layers as described in the definition diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 31e62ad..44e87bc 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -214,6 +214,44 @@ tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error) return queue; } +EXTERN void +tdm_hwc_window_free_buffer_queue(tdm_hwc_window *hwc_window, tbm_surface_queue_h queue) +{ + tdm_private_module *private_module; + tdm_func_hwc_window *func_hwc_window = NULL; + tdm_private_display *private_display; + tdm_private_output *private_output; + tdm_private_hwc *private_hwc; + tdm_private_hwc_window *private_hwc_window; + + if (!hwc_window) + return; + + private_hwc_window = (tdm_private_hwc_window *)hwc_window; + private_hwc = private_hwc_window->private_hwc; + private_output = private_hwc->private_output; + private_display = private_output->private_display; + + TDM_RETURN_IF_FAIL(queue != NULL); + + _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_free_buffer_queue) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return; + } + + func_hwc_window->hwc_window_free_buffer_queue(private_hwc_window->hwc_window_backend, queue); + + _pthread_mutex_unlock(&private_display->lock); + + return; +} + EXTERN tdm_error tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, tdm_hwc_window_composition composition_type) -- 2.7.4 From 888f12665ac7edbf794007d1b0cd365392e64363 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Fri, 10 Aug 2018 13:00:07 +0900 Subject: [PATCH 16/16] Package version up to 2.1.0 Change-Id: I6a3379fd34b5ea40c973a58f046f21867a4462d7 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index d6ac6e3..f6b5c25 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.0.1 +Version: 2.1.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4