From 6eeb0de41fe29e626979bb1fd83588f59184d510 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 14 Jan 2019 19:58:55 +0900 Subject: [PATCH 01/16] Package version up to 2.8.1 Change-Id: I11c67c40256a8e4670538b7d51c81de6a346a59f --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 2d07234..63ab10c 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.0 +Version: 2.8.1 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 1ee366c5e9532ff4a9efdd5ba547f464617a8585 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 21 Jan 2019 19:56:55 +0900 Subject: [PATCH 02/16] server: fix voutput buffer ref error Change-Id: I604afb6f48c17f7b724fadd01580f2abe692224b Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index 4dfcdc1..c66948d 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -926,16 +926,17 @@ _tdm_voutput_cb_disconnect(struct wl_client *client, struct wl_resource *resourc voutput_info->mmwidth = 0; voutput_info->mmheight = 0; + if (voutput_info->request_commit == 1) { + tdm_output_unset_voutput_commit(voutput_info->voutput); + voutput_info->request_commit = 0; + } + if (voutput_info->attach_buffer) { tbm_surface_h buffer = voutput_info->attach_buffer->buffer; tbm_surface_internal_unref(buffer); voutput_info->committing = 0; voutput_info->attach_buffer = NULL; - } - - if (voutput_info->request_commit == 1) { - tdm_output_unset_voutput_commit(voutput_info->voutput); - voutput_info->request_commit = 0; + tdm_voutput_commit_done(voutput_info->voutput); } tdm_voutput_disconnect(voutput_info->voutput); @@ -1148,7 +1149,6 @@ _tdm_output_get_voutput_buffer(tdm_server_voutput_info *voutput_info, tbm_surfac LIST_FOR_EACH_ENTRY(vb, &voutput_info->buffer_list, link) { if (vb && vb->buffer == buffer) { - tbm_surface_internal_ref(vb->buffer); return vb; } } @@ -1206,6 +1206,7 @@ tdm_voutput_attach_buffer(tdm_voutput *voutput, tbm_surface_h buffer) voutput_info->attach_buffer = voutput_buffer; + tbm_surface_internal_ref(buffer); wl_tdm_voutput_send_attach_buffer(voutput_info->resource, voutput_buffer->wl_buffer); return TDM_ERROR_NONE; -- 2.7.4 From 97ed6da7ed4f7663a64fe9436c6ad4292b15c232 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 21 Jan 2019 20:00:45 +0900 Subject: [PATCH 03/16] server: fix voutput mode change error 1. if mode changed, exported wl_buffer is not available. (buffer size changed) so have to destroy old shared wl_buffers. 2. do not executed tdm_output_set_mode directly in voutput_set_mode cb. Change-Id: Iec7bb13ee47949562020464ea1656ec078315816 Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index c66948d..adddc5b 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -72,6 +72,7 @@ typedef struct _tdm_server_voutput_buffer { struct list_head link; struct wl_resource *wl_buffer; tbm_surface_h buffer; + int need_reset; } tdm_server_voutput_buffer; typedef struct _tdm_server_voutput_info { @@ -870,8 +871,8 @@ _tdm_voutput_cb_set_mode(struct wl_client *client, struct wl_resource *resource, tdm_server_voutput_info *voutput_info = NULL; tdm_output *output = NULL; tdm_output_conn_status status = TDM_OUTPUT_CONN_STATUS_DISCONNECTED; - const tdm_output_mode *modes, *mode; - + const tdm_output_mode *modes, *mode, *current_mode; + tdm_server_voutput_buffer *vb = NULL, *vbb = NULL; int count = 0; tdm_error ret; @@ -889,8 +890,21 @@ _tdm_voutput_cb_set_mode(struct wl_client *client, struct wl_resource *resource, mode = &modes[index]; TDM_DBG("mode set request to index:%d (%dx%d, %d)", index, mode->hdisplay, mode->vdisplay, mode->vrefresh); - ret = tdm_output_set_mode(output, mode); + ret = tdm_output_get_mode(output, ¤t_mode); TDM_RETURN_IF_FAIL(ret == TDM_ERROR_NONE); + if (mode == current_mode) { + TDM_DBG("same mode"); + return; + } + + if ((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; + else + wl_tdm_voutput_send_destroy_buffer(voutput_info->resource, vb->wl_buffer); + } + } tdm_output_request_mode_set(voutput_info->output, index); } @@ -935,6 +949,8 @@ _tdm_voutput_cb_disconnect(struct wl_client *client, struct wl_resource *resourc tbm_surface_h buffer = voutput_info->attach_buffer->buffer; tbm_surface_internal_unref(buffer); voutput_info->committing = 0; + if (voutput_info->attach_buffer->need_reset) + wl_tdm_voutput_send_destroy_buffer(voutput_info->resource, voutput_info->attach_buffer->wl_buffer); voutput_info->attach_buffer = NULL; tdm_voutput_commit_done(voutput_info->voutput); } @@ -957,6 +973,8 @@ _tdm_voutput_cb_commit_done(struct wl_client *client, struct wl_resource *resour buffer = voutput_info->attach_buffer->buffer; tbm_surface_internal_unref(buffer); voutput_info->committing = 0; + if (voutput_info->attach_buffer->need_reset) + wl_tdm_voutput_send_destroy_buffer(voutput_info->resource, voutput_info->attach_buffer->wl_buffer); voutput_info->attach_buffer = NULL; if (voutput_info->request_commit == 1) -- 2.7.4 From d71f22895842611f3da167a328351be931e2e0af Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 13 Feb 2019 16:54:50 +0900 Subject: [PATCH 04/16] tdm: check mutex lock status in tdm_display_destroy_private_output some cases the mutex is not locked when called tdm_display_destroy_private_output. so in this case, do not execute mutex unlock/lock for vblank destroy. Change-Id: Ic1439f9d66d763fac00613a37c0154eb0e7c1384 Signed-off-by: Junkyeong Kim --- src/tdm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index 21bd918..81e653a 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -262,6 +262,7 @@ tdm_display_destroy_private_output(tdm_private_output *private_output) tdm_private_output_change_handler *h = NULL, *hh = NULL; tdm_private_output_destroy_handler *dh = NULL, *dhh = NULL; tdm_error ret; + int mutex_locked = 0; ret = tdm_output_call_thread_cb_destroy(private_output); TDM_WARNING_IF_FAIL(ret == TDM_ERROR_NONE); @@ -312,18 +313,19 @@ tdm_display_destroy_private_output(tdm_private_output *private_output) free(dh); } + if (tdm_thread_is_running() && TDM_MUTEX_IS_LOCKED()) mutex_locked = 1; if (private_output->vblank) { /* tdm_vblank APIs is for server. it should be called in unlock status*/ - _pthread_mutex_unlock(&private_display->lock); + if (mutex_locked) _pthread_mutex_unlock(&private_display->lock); tdm_vblank_destroy(private_output->vblank); - _pthread_mutex_lock(&private_display->lock); + if (mutex_locked) _pthread_mutex_lock(&private_display->lock); } if (private_output->ttrace_vblank) { /* tdm_vblank APIs is for server. it should be called in unlock status*/ - _pthread_mutex_unlock(&private_display->lock); + if (mutex_locked) _pthread_mutex_unlock(&private_display->lock); tdm_vblank_destroy(private_output->ttrace_vblank); - _pthread_mutex_lock(&private_display->lock); + if (mutex_locked) _pthread_mutex_lock(&private_display->lock); } LIST_FOR_EACH_ENTRY_SAFE(c, cc, &private_output->capture_list, link) -- 2.7.4 From b28f4175918e663075033cc185959f69a710f7e0 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 13 Feb 2019 17:00:24 +0900 Subject: [PATCH 05/16] virtual: add missed mutex unlock in voutput commit function Change-Id: Ibda51694a9c4c4e5d404a1885a185f350205b74c 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 dfc96ee..43efed1 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1484,6 +1484,7 @@ tdm_output_unset_voutput_commit(tdm_voutput *voutput) ret = tdm_voutput_set_commit_func(private_voutput, NULL); 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 0a37ccf8b2a60d62b7286e8f0debcfccb927e4e1 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 13 Feb 2019 17:26:52 +0900 Subject: [PATCH 06/16] virtual: fix wrong sizeof argument Change-Id: Ib802b19b1aed42b0646d5bd2dd8e814d0aa9c9b2 Signed-off-by: Junkyeong Kim --- 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 43efed1..6516b6c 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -526,7 +526,7 @@ tdm_output_add_mode_change_request_handler(tdm_output *output, } } - mode_change_handler = calloc(1, sizeof(tdm_private_output_change_handler)); + mode_change_handler = calloc(1, sizeof(tdm_private_output_mode_change_handler)); if (!mode_change_handler) { /* LCOV_EXCL_START */ TDM_ERR("failed: alloc memory"); -- 2.7.4 From 0d7ce53d86894753ff1ce7bde7a2537aea4c20a3 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 14 Feb 2019 17:28:34 +0900 Subject: [PATCH 07/16] Package version up to 2.8.2 Change-Id: I1badc7be786edbb2956ae27d16914910ffa04755 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 63ab10c..7bf0a3e 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.1 +Version: 2.8.2 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 6a3f7d243844340bac9104b2e445663806d0db05 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Sun, 24 Feb 2019 14:30:17 +0900 Subject: [PATCH 08/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 09/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 10/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 11/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 12/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 13/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 14/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 15/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 16/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