From 6a3f7d243844340bac9104b2e445663806d0db05 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Sun, 24 Feb 2019 14:30:17 +0900 Subject: [PATCH 01/16] hwc: add tdm_hwc_set_property The user can set the property on the hwc object. Change-Id: I3b918f99957e72135190af95722ece8ff38341b7 --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 9 +++++++++ src/tdm_hwc.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/include/tdm.h b/include/tdm.h index 0a2bcab..53aa771 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1030,6 +1030,16 @@ tdm_error tdm_hwc_commit(tdm_hwc *hwc, int sync, tdm_hwc_commit_handler func, void *user_data); /** + * @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 + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value); + +/** * @brief Destroys the given window. * @param[in] window the pointer of the window to destroy * @since 2.0.0 diff --git a/include/tdm_backend.h b/include/tdm_backend.h index c515934..e89cd91 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -928,6 +928,15 @@ typedef struct _tdm_func_hwc { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_set_commit_handler)(tdm_hwc *hwc, tdm_hwc_commit_handler func); + + /** + * @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 + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_set_property)(tdm_hwc *hwc, uint32_t id, tdm_value value); } tdm_func_hwc; /** diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 2632c5b..b9029be 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -605,4 +605,32 @@ commit_failed: return ret; /* LCOV_EXCL_STOP */ -} \ No newline at end of file +} + +tdm_error +tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value) +{ + 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_property) { + /* 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_property(private_hwc->hwc_backend, id, value); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} -- 2.7.4 From b4bf2e2628819c2e0c1e621defefb4d4de8d7c75 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Sun, 24 Feb 2019 14:41:20 +0900 Subject: [PATCH 02/16] hwc: add tdm_hwc_get_property The user can get the property on the hwc object. Change-Id: I7ac159c31ddb7532f5e76308969f7e0dc8ae5620 --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 9 +++++++++ src/tdm_hwc.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 53aa771..71f7a1c 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1040,6 +1040,16 @@ tdm_error tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value); /** + * @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 + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value); + +/** * @brief Destroys the given window. * @param[in] window the pointer of the window to destroy * @since 2.0.0 diff --git a/include/tdm_backend.h b/include/tdm_backend.h index e89cd91..c5db80a 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -937,6 +937,15 @@ typedef struct _tdm_func_hwc { * @return #TDM_ERROR_NONE if success. Otherwise, error value. */ tdm_error (*hwc_set_property)(tdm_hwc *hwc, uint32_t id, tdm_value value); + + /** + * @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 + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_get_property)(tdm_hwc *hwc, uint32_t id, tdm_value *value); } tdm_func_hwc; /** diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index b9029be..0589bc1 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -634,3 +634,31 @@ tdm_hwc_set_property(tdm_hwc *hwc, uint32_t id, tdm_value value) return ret; } + +tdm_error +tdm_hwc_get_property(tdm_hwc *hwc, uint32_t id, tdm_value *value) +{ + 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_property) { + /* 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_property(private_hwc->hwc_backend, id, value); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} -- 2.7.4 From c09fe83b3fa3804d9810ce6b10405748e3e4a003 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 18 Feb 2019 20:59:37 +0900 Subject: [PATCH 03/16] haltest: enhance tdm_client voutput test add tdm voutput status handler to check the commands works well.(connect, disconnect, mode set) Change-Id: Ia02bc04df72387995b0fcfb7b00acb9cf272cfb9 Signed-off-by: Junkyeong Kim --- haltests/src/tc_tdm_client.cpp | 170 +++++++++++++++++++++++++++++++++++------ 1 file changed, 147 insertions(+), 23 deletions(-) diff --git a/haltests/src/tc_tdm_client.cpp b/haltests/src/tc_tdm_client.cpp index 8243d1f..5d41486 100644 --- a/haltests/src/tc_tdm_client.cpp +++ b/haltests/src/tc_tdm_client.cpp @@ -287,6 +287,53 @@ _tc_tdm_server_set_output_dpms(tdm_display *dpy, int msg) } static void +_tc_tdm_test_server_cb_output_mode_change(tdm_output *output, unsigned int index, void *user_data) +{ + const tdm_output_mode *modes, *mode; + int count = 0; + tdm_error ret; + + ret = tdm_output_get_available_modes(output, &modes, &count); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + TDM_UT_RETURN_IF_FAIL((int)index < count); + + mode = &modes[index]; + + ret = tdm_output_set_mode(output, mode); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + + ret = tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + + ret = tdm_output_commit(output, 0, NULL, NULL); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); +} + +static void +_tc_tdm_output_cb_destroy_handler(tdm_output *output, void *user_data) +{ + tdm_error ret; + + tdm_output_remove_mode_change_request_handler(output, _tc_tdm_test_server_cb_output_mode_change, NULL); + tdm_output_remove_destroy_handler(output, _tc_tdm_output_cb_destroy_handler, NULL); + + ret = tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_OFF); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); +} + +static void +_tc_tdm_output_cb_create_handler(tdm_display *dpy, tdm_output *output, void *user_data) +{ + tdm_error ret = TDM_ERROR_NONE; + + ret = tdm_output_add_mode_change_request_handler(output, _tc_tdm_test_server_cb_output_mode_change, NULL); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + + ret = tdm_output_add_destroy_handler(output, _tc_tdm_output_cb_destroy_handler, NULL); + TDM_UT_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); +} + +static void _tc_tdm_server_run(int *pipe_parent, int *pipe_child) { tdm_display *dpy = NULL; @@ -294,6 +341,7 @@ _tc_tdm_server_run(int *pipe_parent, int *pipe_child) struct pollfd fds[2]; int tdm_fd, err; int output_count = 0; + int virtual_conf; dpy = tdm_display_init(&ret); TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed); @@ -312,6 +360,12 @@ _tc_tdm_server_run(int *pipe_parent, int *pipe_child) TDM_UT_GOTO_IF_FAIL(tc_tdm_output_prepare(dpy, output, true) == true, failed); } + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + if (virtual_conf) { + ret = tdm_display_add_output_create_handler(dpy, _tc_tdm_output_cb_create_handler, NULL); + TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed); + } + TDM_UT_GOTO_IF_FAIL(_tc_tdm_pipe_write_msg(pipe_parent[1], -1, TDM_UT_PIPE_MSG_SERVER_READY) == true, done); TDM_INFO("*** server ready ***"); @@ -1715,13 +1769,61 @@ TEST_F(TDMVirtualOutput, GetClientOutput) ASSERT_NE(output, NULL); } -TEST_F(TDMVirtualOutput, Connect) +static void +_tc_voutput_output_handler_cb(tdm_client_output *output, tdm_output_change_type type, + tdm_value value, void *user_data) +{ + bool *done = (bool *)user_data; + tdm_output_conn_status status; + + if (type == TDM_OUTPUT_CHANGE_CONNECTION) { + status = (tdm_output_conn_status)value.u32; + + if (status == TDM_OUTPUT_CONN_STATUS_CONNECTED) + if (done) *done = true; + } +} + +static void +_tc_voutput_output_handler_cb2(tdm_client_output *output, tdm_output_change_type type, + tdm_value value, void *user_data) +{ + bool *done = (bool *)user_data; + tdm_output_conn_status status; + + if (type == TDM_OUTPUT_CHANGE_CONNECTION) { + status = (tdm_output_conn_status)value.u32; + + if (status == TDM_OUTPUT_CONN_STATUS_DISCONNECTED) + if (done) *done = true; + } +} + +static void +_tc_voutput_output_handler_cb3(tdm_client_output *output, tdm_output_change_type type, + tdm_value value, void *user_data) +{ + bool *done = (bool *)user_data; + tdm_output_conn_status status; + + if (type == TDM_OUTPUT_CHANGE_CONNECTION) { + status = (tdm_output_conn_status)value.u32; + + if (status == TDM_OUTPUT_CONN_STATUS_MODE_SETTED) + if (done) *done = true; + } +} + +TEST_F(TDMVirtualOutput, ConnectDisconnect) { tdm_error ret; + tdm_client_output *output; unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; int virtual_conf; + bool done = false; + bool done2 = false; if (this->voutput == NULL) { virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); @@ -1729,6 +1831,16 @@ TEST_F(TDMVirtualOutput, Connect) return; } + output = tdm_client_voutput_get_client_output(this->voutput, &ret); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ASSERT_NE(output, NULL); + + ret = tdm_client_output_add_change_handler(output, _tc_voutput_output_handler_cb, &done); + ASSERT_EQ(ret, TDM_ERROR_NONE); + + ret = tdm_client_output_add_change_handler(output, _tc_voutput_output_handler_cb2, &done2); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1739,36 +1851,30 @@ TEST_F(TDMVirtualOutput, Connect) ret = tdm_client_voutput_connect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 0); -} - -TEST_F(TDMVirtualOutput, Disconnect) -{ - tdm_error ret; - int virtual_conf; - - if (this->voutput == NULL) { - virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); - ASSERT_EQ(virtual_conf, 0); - return; - } - -// TDM_UT_WAIT("check & press"); + while (!done) + ASSERT_EQ(tdm_client_handle_events_timeout(this->client, 3000), TDM_ERROR_NONE); ret = tdm_client_voutput_disconnect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 0); -} + while (!done2) + ASSERT_EQ(tdm_client_handle_events_timeout(this->client, 3000), TDM_ERROR_NONE); + tdm_client_output_remove_change_handler(output, _tc_voutput_output_handler_cb, &done); + tdm_client_output_remove_change_handler(output, _tc_voutput_output_handler_cb2, &done2); +} TEST_F(TDMVirtualOutput, SetMode) { tdm_error ret; + tdm_client_output *output; unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; int virtual_conf; + bool done = false; + bool done2 = false; + bool done3 = false; if (this->voutput == NULL) { virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); @@ -1776,6 +1882,17 @@ TEST_F(TDMVirtualOutput, SetMode) return; } + output = tdm_client_voutput_get_client_output(this->voutput, &ret); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ASSERT_NE(output, NULL); + + ret = tdm_client_output_add_change_handler(output, _tc_voutput_output_handler_cb, &done); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ret = tdm_client_output_add_change_handler(output, _tc_voutput_output_handler_cb2, &done2); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ret = tdm_client_output_add_change_handler(output, _tc_voutput_output_handler_cb3, &done3); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1786,16 +1903,23 @@ TEST_F(TDMVirtualOutput, SetMode) ret = tdm_client_voutput_connect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 100); + while (!done) + ASSERT_EQ(tdm_client_handle_events_timeout(this->client, 3000), TDM_ERROR_NONE); ASSERT_EQ(tdm_client_voutput_set_mode(this->voutput, count - 1), TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 100); + while (!done3) + ASSERT_EQ(tdm_client_handle_events_timeout(this->client, 3000), TDM_ERROR_NONE); ret = tdm_client_voutput_disconnect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 0); + while (!done2) + ASSERT_EQ(tdm_client_handle_events_timeout(this->client, 3000), TDM_ERROR_NONE); + + tdm_client_output_remove_change_handler(output, _tc_voutput_output_handler_cb, &done); + tdm_client_output_remove_change_handler(output, _tc_voutput_output_handler_cb2, &done2); + tdm_client_output_remove_change_handler(output, _tc_voutput_output_handler_cb3, &done3); } TEST_F(TDMVirtualOutput, SetModeNullObject) @@ -1822,7 +1946,7 @@ TEST_F(TDMVirtualOutput, SetModeNullObject) ret = tdm_client_voutput_connect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 100); + tdm_client_handle_events_timeout(this->client, 50); ASSERT_EQ(tdm_client_voutput_set_mode(NULL, 0), TDM_ERROR_INVALID_PARAMETER); @@ -1856,7 +1980,7 @@ TEST_F(TDMVirtualOutput, SetModeInvalidIndex) ret = tdm_client_voutput_connect(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); - tdm_client_handle_events_timeout(this->client, 100); + tdm_client_handle_events_timeout(this->client, 50); ASSERT_EQ(tdm_client_voutput_set_mode(this->voutput, -1), TDM_ERROR_INVALID_PARAMETER); -- 2.7.4 From 9423a5a578d135c6dc225de6bcbcb713564a2cd6 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 20 Feb 2019 10:20:36 +0900 Subject: [PATCH 04/16] server: check null of current mode for voutput set mode Change-Id: I11f8753d7493d2b977fd34e3f757fc5a046abafc Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index adddc5b..6c4c6ab 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -897,7 +897,7 @@ _tdm_voutput_cb_set_mode(struct wl_client *client, struct wl_resource *resource, return; } - if ((mode->hdisplay != current_mode->hdisplay) || (mode->vdisplay != current_mode->vdisplay)) { + if (current_mode && ((mode->hdisplay != current_mode->hdisplay) || (mode->vdisplay != current_mode->vdisplay))) { LIST_FOR_EACH_ENTRY_SAFE(vb, vbb, &voutput_info->buffer_list, link) { if (vb->wl_buffer == voutput_info->attach_buffer->wl_buffer) voutput_info->attach_buffer->need_reset = 1; -- 2.7.4 From d2b86709393a6e7fba1e22a82625e4c2514c8a7e Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 20 Feb 2019 20:24:16 +0900 Subject: [PATCH 05/16] tdm_helper: add checking hwc mode for tdm-monitor -info fix seg fault. Change-Id: I868e8999e07e4b39296ed9691e2e11f528323fdb Signed-off-by: Junkyeong Kim --- src/tdm_helper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tdm_helper.c b/src/tdm_helper.c index e9db919..804a112 100644 --- a/src/tdm_helper.c +++ b/src/tdm_helper.c @@ -856,6 +856,11 @@ _tdm_helper_get_backend_information(tdm_private_module *private_module, char *re TDM_SNPRINTF(reply, len, "idx output zpos buf format size crop geometry transform\n"); TDM_SNPRINTF(reply, len, "-----------------------------------------------------------------------\n"); LIST_FOR_EACH_ENTRY(private_output, &private_module->output_list, link) { + if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) { + TDM_SNPRINTF(reply, len, "(no layer), hwc mode on\n"); + continue; + } + LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) { if (!private_layer->usable) { tdm_info_layer info; -- 2.7.4 From 3ef65c3f5bab0388b4cda04af84b3f0690faf257 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 6 Mar 2019 18:14:31 +0900 Subject: [PATCH 06/16] add systemd unit before option Change-Id: I8b79673a23d8f7be198ab7a88cce2f39ba97f70e Signed-off-by: Junkyeong Kim --- service/tdm-socket-user.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/tdm-socket-user.service b/service/tdm-socket-user.service index c2e7a18..b42b642 100644 --- a/service/tdm-socket-user.service +++ b/service/tdm-socket-user.service @@ -1,7 +1,8 @@ [Unit] Description=Creating a link file for user to access tdm-socket DefaultDependencies=no +Before=starter.service [Service] Type=oneshot -ExecStart=/usr/bin/ln -s /run/tdm-socket /run/user/%U/ +ExecStart=/usr/bin/sh -c "while [ ! -e /run/tdm-socket ] ; do /usr/bin/sleep .1 ; done ;/usr/bin/ln -s /run/tdm-socket /run/user/%U/" -- 2.7.4 From 467676689e95461455f3ea6e2c994617e613f2cc Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 7 Mar 2019 17:19:46 +0900 Subject: [PATCH 07/16] Package version up to 2.8.3 Change-Id: Ia72f18868fb5e6db682597edaa095a3e703fd253 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 7bf0a3e..9a23587 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.2 +Version: 2.8.3 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From b0316bc50edba33498a86f9a6cf4d857ab836bf3 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 21 Mar 2019 13:31:22 +0900 Subject: [PATCH 08/16] tdm_server: fix stack buffer overflow Change-Id: I7b762077a0834a4873adaf894668290285f65f7d Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index 6c4c6ab..cfaf044 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -148,8 +148,8 @@ _tdm_server_get_process_name(pid_t pid, char *name, unsigned int size) len = fread(pname, sizeof(char), TDM_NAME_LEN, h); if (len == 0) { - char *p = strncpy(pname, "NO NAME", sizeof(pname) - 1); - len = p - pname; + strncpy(pname, "NO NAME", 7); + len = 8; } pname[len - 1] = '\0'; -- 2.7.4 From 037c71e16d6baa284aaef55a06bd916c5ff8f750 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 1 Apr 2019 18:51:12 +0900 Subject: [PATCH 09/16] Package version up to 2.8.4 Change-Id: I731b9115a083a2c412e3c589deaf0f31d62f9766 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 9a23587..3188c89 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.3 +Version: 2.8.4 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From c912cbe6b33ba30309388719316775e5fc44555a Mon Sep 17 00:00:00 2001 From: Mateusz Moscicki Date: Fri, 19 Apr 2019 13:54:17 +0200 Subject: [PATCH 10/16] tizen: Add additional unit for "unified" user session The unified user session is about moving user session units, managed by systemd --user, to main systemd, where it's managed as part of newly created user@.target. user@.target will contain same units as previously available in user/, with same UID and environment setup. systemd instance is used for unit to be able to specify UID (inherited from user@.target). The rationale behind this work is following: * VD requirement to remove user session support * boot time optimization requirements, due to: + 'systemd --user' taking 1s its own startup that could be used for unit startup + ability to better rearrange units if these managed by one systemd instance Unit installed by this commit will not be used till user login mechanism will be changed in systemd package (via changing pam_systemd to start user@.target, rather than user@.service). Change-Id: I86da33a05560b73c44c39c073f4ac6ca11fd6e86 --- packaging/libtdm.spec | 10 ++++++++++ service/tdm-socket-user@.path | 9 +++++++++ service/tdm-socket-user@.service | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 service/tdm-socket-user@.path create mode 100644 service/tdm-socket-user@.service diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 3188c89..cb3c0c8 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -98,6 +98,10 @@ rm -rf %{buildroot} install -m 644 service/tdm-socket-user.service %{buildroot}%{_unitdir_user} install -m 644 service/tdm-socket-user.path %{buildroot}%{_unitdir_user} +%__mkdir_p %{buildroot}%{_unitdir} +install -m 644 service/tdm-socket-user@.service %{buildroot}%{_unitdir} +install -m 644 service/tdm-socket-user@.path %{buildroot}%{_unitdir} + %remove_docs @@ -105,9 +109,13 @@ install -m 644 service/tdm-socket-user.path %{buildroot}%{_unitdir_user} %__mkdir_p %{_unitdir_user}/basic.target.wants ln -sf ../tdm-socket-user.path %{_unitdir_user}/basic.target.wants/ +%__mkdir_p %{_unitdir}/user-basic@.target.wants +ln -sf ../tdm-socket-user@.path %{_unitdir}/user-basic@.target.wants/ + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig rm -f %{_unitdir_user}/basic.target.wants/tdm-socket-user.path +rm -f %{_unitdir}/user-basic@.target.wants/tdm-socket-user@.path %files %manifest %{name}.manifest @@ -119,6 +127,8 @@ rm -f %{_unitdir_user}/basic.target.wants/tdm-socket-user.path %attr(750,root,root) %{_bindir}/tdm-monitor %{_unitdir_user}/tdm-socket-user.path %{_unitdir_user}/tdm-socket-user.service +%{_unitdir}/tdm-socket-user@.path +%{_unitdir}/tdm-socket-user@.service %files devel %manifest %{name}.manifest diff --git a/service/tdm-socket-user@.path b/service/tdm-socket-user@.path new file mode 100644 index 0000000..e71810c --- /dev/null +++ b/service/tdm-socket-user@.path @@ -0,0 +1,9 @@ +[Unit] +PartOf=userlogin@%i.target +DefaultDependencies=no +After=systemd-logind.service +After=systemd-logind.service systemd-logind.service +Description=Wait for tdm-socket + +[Path] +PathExists=/run/tdm-socket diff --git a/service/tdm-socket-user@.service b/service/tdm-socket-user@.service new file mode 100644 index 0000000..4fca44d --- /dev/null +++ b/service/tdm-socket-user@.service @@ -0,0 +1,15 @@ +[Unit] +PartOf=userlogin@%i.target +After=systemd-logind.service +After=display-manager.service systemd-logind.service +Description=Creating a link file for user to access tdm-socket +DefaultDependencies=no +Before=starter@%i.service + +[Service] +User=%i +Environment=DBUS_SESSION_BUS_ADDRESS=kernel:path=/sys/fs/kdbus/%i-user/bus;unix:path=/run/user/%i/bus +Environment=XDG_RUNTIME_DIR=/run/user/%i +SmackProcessLabel=User +Type=oneshot +ExecStart=/usr/bin/sh -c "while [ ! -e /run/tdm-socket ] ; do /usr/bin/sleep .1 ; done ;/usr/bin/ln -s /run/tdm-socket /run/user/%i/" -- 2.7.4 From 85eff7cbb708f7c1fbafac3c2c721a0e08da9e1a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 3 May 2019 08:41:50 +0900 Subject: [PATCH 11/16] Package version up to 2.8.5 Change-Id: Ie60e55a1c1749ef2049ddbb1d1f38bc94d9545e7 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index cb3c0c8..cfa6ed6 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.4 +Version: 2.8.5 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From ee203debcbb7e7e595c6da2663759a1bb1f429ed Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:04:27 +0900 Subject: [PATCH 12/16] tdm_output: add missing mutex unlock Change-Id: Ia61c524b809cfa45a25f3415af4fea7e036a53ee Signed-off-by: Junkyeong Kim --- src/tdm_output.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tdm_output.c b/src/tdm_output.c index 6516b6c..8354d07 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1427,6 +1427,7 @@ tdm_output_set_voutput_commit(tdm_voutput *voutput) ret = tdm_voutput_set_commit_func(private_voutput, _tdm_voutput_cb_commit); if (ret != TDM_ERROR_NONE) { TDM_ERR("failed: tdm_voutput_set_commit_func"); + _pthread_mutex_unlock(&private_display->lock); return ret; } } -- 2.7.4 From 8beab8406229bf9f2f26954b98031f5537ffbe39 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:21:47 +0900 Subject: [PATCH 13/16] tdm_client: check calloc fail Change-Id: I30ffda55cd4d44d794057321ed79c936d4b186d0 Signed-off-by: Junkyeong Kim --- client/tdm_client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/tdm_client.c b/client/tdm_client.c index 3a2ab48..bde7a1f 100644 --- a/client/tdm_client.c +++ b/client/tdm_client.c @@ -2218,6 +2218,11 @@ tdm_client_voutput_set_available_modes(tdm_client_voutput *voutput, const tdm_cl if (count != 0) { private_voutput->available_modes.modes = calloc(count, sizeof(tdm_client_output_mode)); + if (private_voutput->available_modes.modes == NULL) { + private_voutput->available_modes.count = 0; + pthread_mutex_unlock(&private_client->lock); + return TDM_ERROR_OUT_OF_MEMORY; + } memcpy(private_voutput->available_modes.modes, modes, sizeof(tdm_client_output_mode) * count); } -- 2.7.4 From e315fbafc737fdcb044cba2a7f0c5b7d5a0820ee Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:30:54 +0900 Subject: [PATCH 14/16] Package version up to 2.8.6 Change-Id: Icba91a8d99300925c3d6721c5f2fa85d5c0ee855 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 cfa6ed6..3fc5591 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.5 +Version: 2.8.6 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From be738dc070af5710a42b3316f7f5a49fd2ac8d2c Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Wed, 10 Jul 2019 14:57:57 +0900 Subject: [PATCH 15/16] tdm_output: fix log parameter Change-Id: If32820c0679e29f76c6dadc1df57663fc3114d98 Signed-off-by: YoungJun Cho --- src/tdm_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tdm_output.c b/src/tdm_output.c index 8354d07..8272cc3 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -429,7 +429,7 @@ tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms, void *user_ tdm_private_output *private_output = user_data; tdm_error ret; - TDM_INFO("output(%d) %s", private_output->pipe, tdm_status_str(dpms)); + TDM_INFO("output(%d) %s", private_output->pipe, tdm_dpms_str(dpms)); private_output->current_dpms_value = dpms; private_output->waiting_dpms_change = 0; -- 2.7.4 From 691fe1866fab25603336cc11e6bba47c0064ca98 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 12 Jul 2019 17:47:29 +0900 Subject: [PATCH 16/16] tdm_output: execute mutex unlock before call direct commit handler Change-Id: I14a8899be608cd61ae30603a5ca384d7c8da4393 Signed-off-by: Junkyeong Kim --- src/tdm_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tdm_output.c b/src/tdm_output.c index 8272cc3..285887e 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1630,8 +1630,11 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms_value)) { TDM_WRN("dpms %s. Directly call commit handler instead of commit.", tdm_dpms_str(dpms_value)); - if (func) + if (func) { + _pthread_mutex_unlock(&private_display->lock); func(output, 0, 0, 0, user_data); + _pthread_mutex_lock(&private_display->lock); + } } return ret; -- 2.7.4