From 8f1377d4928ad9bdcc0cf10e16bfd24a3ed56de3 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 4 Dec 2018 11:18:59 +0900 Subject: [PATCH 01/16] add tdm_hwc_window_set_cursor_image let the tdm backend know the virtual address and information of the cursor image. Change-Id: I31716a8fae97affb5ab801027c081bd0d2bdccbc --- include/tdm.h | 12 ++++++++++++ include/tdm_backend.h | 12 ++++++++++++ src/tdm_hwc_window.c | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/include/tdm.h b/include/tdm.h index 63edce4..c18b27e 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1159,6 +1159,18 @@ tdm_error tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name); /** + * @brief Get buffer flags of cursor hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] width of the cursor image + * @param[in] height of the cursor image + * @param[in] stride of the cursor image + * @param[in] virtual address of the cursor image + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr); + +/** * @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 1b73ba9..b131ced 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1056,6 +1056,18 @@ typedef struct _tdm_func_hwc_window { */ tdm_error (*hwc_window_set_name)(tdm_hwc_window *hwc_window, const char *name); + + /** + * @brief Get buffer flags of cursor hwc_window + * @param[in] hwc_window A hwc window object + * @param[in] width of the cursor image + * @param[in] height of the cursor image + * @param[in] stride of the cursor image + * @param[in] virtual address of the cursor image + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ + tdm_error (*hwc_window_set_cursor_image)(tdm_hwc_window *hwc_window, + int width, int height, int stride, void *ptr); } tdm_func_hwc_window; /** diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index fd86345..8f5fcda 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -493,4 +493,30 @@ tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name) return ret; } + +tdm_error +tdm_hwc_window_set_cursor_image(tdm_hwc_window *hwc_window, int width, int height, int stride, void *ptr) +{ + 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_set_cursor_image) { + _pthread_mutex_unlock(&private_display->lock); + TDM_WRN("not implemented!!"); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_hwc_window->hwc_window_set_cursor_image(private_hwc_window->hwc_window_backend, width, height, stride, ptr); + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} /* LCOV_EXCL_STOP */ \ No newline at end of file -- 2.7.4 From d3cdde0ab4edb3711a9a31d02b2eb4e1ada07a05 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 3 Dec 2018 17:27:55 +0900 Subject: [PATCH 02/16] Package version up to 2.6.0 Change-Id: Ia420089798803f6e3ae5e8000a466b7600c981f4 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 94174cb..cec90ca 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.5.1 +Version: 2.6.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 1e5cde6cf72bf4242af6e9d1c2a6d57b5e2311ad Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 14 Dec 2018 08:42:07 +0900 Subject: [PATCH 03/16] hwc: add the hwc capabilities replace hwc video capabilities into hwc capabilities Change-Id: I1b9640b5c3bd06dff5899f9628de40f3ac0fa911 --- include/tdm.h | 6 +++--- include/tdm_backend.h | 7 +++---- include/tdm_common.h | 11 ++++++----- src/tdm_hwc.c | 8 +++----- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/tdm.h b/include/tdm.h index c18b27e..125ca56 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -917,13 +917,13 @@ tdm_error tdm_hwc_get_video_available_properties(tdm_hwc *hwc, const tdm_prop **props, int *count); /** - * @brief Get the hwc video capability + * @brief Get the hwc capabilites * @param[in] hwc A hwc object - * @param[out] video_capability A hwc video capability + * @param[out] capabilities A hwc 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); +tdm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities); /** * @brief Get the available property array of a hwc object. diff --git a/include/tdm_backend.h b/include/tdm_backend.h index b131ced..c515934 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -813,13 +813,12 @@ typedef struct _tdm_func_hwc { int *count); /** - * @brief Get the hwc video capability + * @brief Get the hwc capabilities * @param[in] hwc A hwc object - * @param[out] video_capability A hwc hwc video capability + * @param[out] capabilities A hwc hwc 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); + tdm_error (*hwc_get_capabilities)(tdm_hwc *hwc, tdm_hwc_capability *capabilities); /** * @brief Get the available property array of a hwc object. diff --git a/include/tdm_common.h b/include/tdm_common.h index b402277..70a081c 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -261,13 +261,14 @@ typedef enum { /* * @brief The hwc video capability enumeration - * @since 2.0.0 + * @since 2.7.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; + TDM_HWC_CAPABILITY_VIDEO_STREAM = (1 << 1), /**< if a hwc has video stream capability */ + TDM_HWC_CAPABILITY_VIDEO_SCALE = (1 << 2), /**< if a hwc allows to scale the video buffer */ + TDM_HWC_CAPABILITY_VIDEO_TRANSFORM = (1 << 3), /**< if a hwc allows video to transform the video buffer */ + TDM_HWC_CAPABILITY_VIDEO_SCANOUT = (1 << 4), /**< if a hwc allows video to accept the scanout buffer only */ +} tdm_hwc_capability; /** * @brief The size structure diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index fc9563c..2632c5b 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -240,8 +240,7 @@ tdm_hwc_get_video_available_properties(tdm_hwc *hwc, const tdm_prop **props, int } EXTERN tdm_error -tdm_hwc_get_video_capability(tdm_hwc *hwc, - tdm_hwc_video_capability *video_capability) +tdm_hwc_get_capabilities(tdm_hwc *hwc, tdm_hwc_capability *capabilities) { tdm_private_module *private_module; tdm_func_hwc *func_hwc; @@ -253,14 +252,13 @@ tdm_hwc_get_video_capability(tdm_hwc *hwc, private_module = private_output->private_module; func_hwc = &private_module->func_hwc; - if (!func_hwc->hwc_get_video_capability) { + if (!func_hwc->hwc_get_capabilities) { _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); + ret = func_hwc->hwc_get_capabilities(private_hwc->hwc_backend, capabilities); _pthread_mutex_unlock(&private_display->lock); -- 2.7.4 From 95af5139e398eba6799b80b503ec2b98d0d9ee16 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 14 Dec 2018 09:58:50 +0900 Subject: [PATCH 04/16] Package version up to 2.7.0 Change-Id: I3f0fbf6c8055b9d200d60dc93ab48bdc30da10e7 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index cec90ca..fc162ee 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.6.0 +Version: 2.7.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From be18f2c10b95570b5ea0c6c9839254febe4a6352 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 19 Dec 2018 16:42:08 +0900 Subject: [PATCH 05/16] tdm_server: check timeout flag and vblank_info in timeout callback Change-Id: Ie203b32e29bab94dcb386884e05a1e87a9c5bab4 --- src/tdm_server.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index 76bae78..31ddf14 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -218,9 +218,12 @@ _tdm_server_timeout_timer_cb(void *user_data) tv_usec = TDM_TIME_USEC(curr); LIST_FOR_EACH_ENTRY(wait_info, &keep_private_server->wait_list, link) { + if (wait_info->timeout) continue; + if (vblank_info != wait_info->vblank_info) continue; + wl_tdm_vblank_send_done(vblank_info->resource, wait_info->req_id, 0, tv_sec, tv_usec, TDM_ERROR_TIMEOUT); - TDM_ERR("tdm_server_vblank(%p) req_id(%d) timeout force send vblank", vblank_info); + TDM_ERR("tdm_server_vblank(%p) req_id(%d) timeout force send vblank", vblank_info, wait_info->req_id); wait_info->timeout = 1; } -- 2.7.4 From b9ad695b3a0278c35bbe1deb419808c6a1fcb3df Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 19 Dec 2018 16:47:46 +0900 Subject: [PATCH 06/16] Package version up to 2.7.1 Change-Id: I754504ebcac8b4af01c23e09a6037f264835fbfc --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index fc162ee..23e7273 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.7.0 +Version: 2.7.1 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 70fed1b2a9e9a77f139e63fa1844cf90120322cb Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 11 Dec 2018 21:22:03 +0900 Subject: [PATCH 07/16] virtual: fix voutput commit buffer send fail add tdm_output_set_voutput_commit / tdm_output_unset_voutput_commit execute set_voutput_commit when connect. execute unset_voutput_commit when disconnect. cause of tdm thread, the voutput commit request has to be set by client. before code the voutput commit was set from server(main thread), client cannot get buffer attach and commit event from server. Change-Id: I244d9b8b93b3994cba760b9aa8b1ebdfa3102e68 Signed-off-by: Junkyeong Kim --- backends/virtual/tdm_virtual_display.c | 6 +- src/tdm_output.c | 170 ++++++++++++++++++++++++--------- src/tdm_private.h | 4 + src/tdm_private_types.h | 2 + src/tdm_server.c | 22 ++++- 5 files changed, 155 insertions(+), 49 deletions(-) diff --git a/backends/virtual/tdm_virtual_display.c b/backends/virtual/tdm_virtual_display.c index 875dce4..2d407fe 100644 --- a/backends/virtual/tdm_virtual_display.c +++ b/backends/virtual/tdm_virtual_display.c @@ -457,8 +457,9 @@ virtual_output_commit(tdm_output *output, int sync, void *user_data) output_data->status_user_data); } + layer_data = output_data->primary_layer; + if (voutput_data->vcommit_func) { - layer_data = output_data->primary_layer; if (layer_data->display_buffer_changed) { output_data->commit_user_data = user_data; event_data = calloc(1, sizeof(tdm_virtual_event_data)); @@ -495,6 +496,8 @@ virtual_output_commit(tdm_output *output, int sync, void *user_data) } } + layer_data->display_buffer_changed = 0; + return TDM_ERROR_NONE; } @@ -940,7 +943,6 @@ virtual_output_set_commit_func(tdm_voutput *voutput, tdm_voutput_commit_handler tdm_virtual_voutput_data *voutput_data = voutput; RETURN_VAL_IF_FAIL(voutput_data, TDM_ERROR_INVALID_PARAMETER); - RETURN_VAL_IF_FAIL(commit_func, TDM_ERROR_INVALID_PARAMETER); voutput_data->vcommit_func = commit_func; diff --git a/src/tdm_output.c b/src/tdm_output.c index e043569..dfc96ee 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1101,7 +1101,7 @@ _tdm_voutput_thread_cb_commit(tdm_private_display *private_display, void *object TDM_INFO("handler(%p)", voutput_commit_handler); } - if (voutput_commit_handler->func) { + if (voutput_commit_handler->func && private_voutput->set_voutput_commit != 0) { _pthread_mutex_unlock(&private_display->lock); voutput_commit_handler->func(private_voutput, voutput_commit_handler->user_data); _pthread_mutex_lock(&private_display->lock); @@ -1137,9 +1137,9 @@ _tdm_voutput_cb_commit(tdm_voutput *voutput_backend, unsigned int sequence, return; } - LIST_FOR_EACH_ENTRY(voutput_commit_handler, &private_voutput->voutput_commit_handler_list, link) { - if (voutput_commit_handler) break; - } + if (LIST_LENGTH(&private_voutput->voutput_commit_handler_list) == 0) return; + + voutput_commit_handler = LIST_FIRST_ENTRY(&private_voutput->voutput_commit_handler_list, tdm_private_voutput_commit_handler, link); private_output = private_voutput->private_output; @@ -1401,6 +1401,119 @@ _voutput_commit_func(tdm_voutput *voutput, tbm_surface_h buffer) } INTERN tdm_error +tdm_output_set_voutput_commit(tdm_voutput *voutput) +{ + tdm_private_display *private_display; + tdm_private_output *private_output; + tdm_private_voutput *private_voutput; + tdm_private_voutput_commit_handler *voutput_commit_handler = NULL; + tdm_error ret = TDM_ERROR_NONE; + + TDM_RETURN_VAL_IF_FAIL(voutput != NULL, TDM_ERROR_INVALID_PARAMETER); + + private_voutput = (tdm_private_voutput *)voutput; + private_display = private_voutput->private_display; + private_output = (tdm_private_output *)private_voutput->private_output; + + _pthread_mutex_lock(&private_display->lock); + + if (LIST_LENGTH(&private_voutput->voutput_commit_handler_list) != 0) { + _pthread_mutex_unlock(&private_display->lock); + return ret; + } + + if (!private_voutput->regist_commit_cb) { + private_voutput->regist_commit_cb = 1; + 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"); + return ret; + } + } + + voutput_commit_handler = calloc(1, sizeof(tdm_private_voutput_commit_handler)); + if (!voutput_commit_handler) { + /* LCOV_EXCL_START */ + TDM_ERR("failed: alloc memory"); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_OUT_OF_MEMORY; + /* LCOV_EXCL_STOP */ + } + + ret = tdm_thread_cb_add(private_output->private_voutput, TDM_THREAD_CB_VOUTPUT_COMMIT, voutput_commit_handler, _tdm_voutput_thread_cb_commit, NULL); + if (ret != TDM_ERROR_NONE) { + TDM_ERR("tdm_thread_cb_add failed"); + free(voutput_commit_handler); + _pthread_mutex_unlock(&private_display->lock); + return ret; + } + + LIST_ADDTAIL(&voutput_commit_handler->link, &private_voutput->voutput_commit_handler_list); + voutput_commit_handler->private_voutput = private_voutput; + voutput_commit_handler->func = _voutput_commit_func; + voutput_commit_handler->owner_tid = syscall(SYS_gettid); + + private_voutput->set_voutput_commit = 1; + + _pthread_mutex_unlock(&private_display->lock); + + return ret; +} + +INTERN tdm_error +tdm_output_unset_voutput_commit(tdm_voutput *voutput) +{ + tdm_private_display *private_display; + tdm_private_output *private_output; + tdm_private_voutput *private_voutput; + tdm_private_voutput_commit_handler *voutput_commit_handler = NULL; + tdm_error ret = TDM_ERROR_NONE; + + TDM_RETURN_VAL_IF_FAIL(voutput != NULL, TDM_ERROR_INVALID_PARAMETER); + + private_voutput = (tdm_private_voutput *)voutput; + private_display = private_voutput->private_display; + private_output = (tdm_private_output *)private_voutput->private_output; + + _pthread_mutex_lock(&private_display->lock); + + private_voutput->set_voutput_commit = 0; + + if (private_voutput->regist_commit_cb) { + private_voutput->regist_commit_cb = 0; + ret = tdm_voutput_set_commit_func(private_voutput, NULL); + if (ret != TDM_ERROR_NONE) { + TDM_ERR("failed: tdm_voutput_set_commit_func"); + return ret; + } + } + + if (LIST_LENGTH(&private_voutput->voutput_commit_handler_list) == 0) { + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NONE; + } + + if (LIST_LENGTH(&private_output->output_commit_handler_list) != 0) { + //commiting. don't remove voutput commit thread here + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NONE; + } + + if (LIST_LENGTH(&private_voutput->voutput_commit_handler_list) != 0) { + voutput_commit_handler = LIST_FIRST_ENTRY(&private_voutput->voutput_commit_handler_list, tdm_private_voutput_commit_handler, link); + } else { + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NONE; + } + + tdm_thread_cb_remove(private_output->private_voutput, TDM_THREAD_CB_VOUTPUT_COMMIT, voutput_commit_handler, _tdm_voutput_thread_cb_commit, NULL); + + _pthread_mutex_unlock(&private_display->lock); + + return TDM_ERROR_NONE; +} + +INTERN tdm_error tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handler func, void *user_data) { tdm_private_display *private_display; @@ -1452,38 +1565,12 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl free(output_commit_handler); return TDM_ERROR_BAD_MODULE; } - private_voutput = private_output->private_voutput; - - if (!private_voutput->regist_commit_cb) { - private_voutput->regist_commit_cb = 1; - ret = tdm_voutput_set_commit_func(private_voutput, _tdm_voutput_cb_commit); - TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed); - } - - voutput_commit_handler = calloc(1, sizeof(tdm_private_voutput_commit_handler)); - if (!voutput_commit_handler) { - /* LCOV_EXCL_START */ - TDM_ERR("failed: alloc memory"); - free(output_commit_handler); - return TDM_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ - } - - ret = tdm_thread_cb_add(private_output->private_voutput, TDM_THREAD_CB_VOUTPUT_COMMIT, voutput_commit_handler, _tdm_voutput_thread_cb_commit, NULL); - if (ret != TDM_ERROR_NONE) { - TDM_ERR("tdm_thread_cb_add failed"); - free(voutput_commit_handler); - free(output_commit_handler); - return ret; - } } ret = tdm_thread_cb_add(private_output, TDM_THREAD_CB_OUTPUT_COMMIT, output_commit_handler, _tdm_output_thread_cb_commit, NULL); if (ret != TDM_ERROR_NONE) { TDM_ERR("tdm_thread_cb_add failed"); free(output_commit_handler); - if (voutput_commit_handler) - free(voutput_commit_handler); return ret; } @@ -1493,17 +1580,16 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl output_commit_handler->user_data = user_data; output_commit_handler->owner_tid = syscall(SYS_gettid); - if (voutput_commit_handler) { + if (private_module == private_display->virtual_module) { + private_voutput = private_output->private_voutput; + /* voutput use only 1 layer */ - LIST_FOR_EACH_ENTRY(private_layer, &private_output->layer_list, link) { - if (private_layer) break; - } + private_layer = LIST_FIRST_ENTRY(&private_output->layer_list, tdm_private_layer, link); - LIST_ADDTAIL(&voutput_commit_handler->link, &private_voutput->voutput_commit_handler_list); - voutput_commit_handler->private_voutput = private_voutput; - voutput_commit_handler->func = _voutput_commit_func; - voutput_commit_handler->user_data = private_layer->commiting_buffer; - voutput_commit_handler->owner_tid = syscall(SYS_gettid); + if (LIST_LENGTH(&private_voutput->voutput_commit_handler_list) != 0) { + voutput_commit_handler = LIST_FIRST_ENTRY(&private_voutput->voutput_commit_handler_list, tdm_private_voutput_commit_handler, link); + voutput_commit_handler->user_data = private_layer->commiting_buffer; + } } ret = func_output->output_commit(private_output->output_backend, sync, @@ -1555,11 +1641,7 @@ commit_failed: LIST_DEL(&output_commit_handler->link); free(output_commit_handler); } - if (voutput_commit_handler) { - tdm_thread_cb_remove(private_output->private_voutput, TDM_THREAD_CB_VOUTPUT_COMMIT, voutput_commit_handler, _tdm_voutput_thread_cb_commit, NULL); - LIST_DEL(&voutput_commit_handler->link); - free(voutput_commit_handler); - } + return ret; /* LCOV_EXCL_STOP */ } diff --git a/src/tdm_private.h b/src/tdm_private.h index 9e10713..b65c01e 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -279,6 +279,10 @@ tdm_voutput_attach_buffer(tdm_voutput *voutput, tbm_surface_h buffer); tdm_error tdm_voutput_commit_buffer(tdm_voutput *voutput); tdm_error +tdm_output_set_voutput_commit(tdm_voutput *voutput); +tdm_error +tdm_output_unset_voutput_commit(tdm_voutput *voutput); +tdm_error tdm_voutput_commit_done(tdm_voutput *voutput); void * tdm_display_find_private_voutput(tdm_private_display *private_display, double stamp); diff --git a/src/tdm_private_types.h b/src/tdm_private_types.h index 993be0e..80d867f 100644 --- a/src/tdm_private_types.h +++ b/src/tdm_private_types.h @@ -267,6 +267,8 @@ struct _tdm_private_voutput { unsigned int mmwidth; unsigned int mmheight; int connect_status; + + int set_voutput_commit; }; struct _tdm_private_layer { diff --git a/src/tdm_server.c b/src/tdm_server.c index 31ddf14..dc4f25a 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -93,6 +93,7 @@ typedef struct _tdm_server_voutput_info { struct list_head buffer_list; tdm_server_voutput_buffer *attach_buffer; int committing; + unsigned int request_commit; } tdm_server_voutput_info; typedef struct _tdm_server_vblank_info { @@ -902,9 +903,12 @@ _tdm_voutput_cb_connect(struct wl_client *client, struct wl_resource *resource) voutput_info = wl_resource_get_user_data(resource); voutput_info->status = TDM_OUTPUT_CONN_STATUS_CONNECTED; + voutput_info->request_commit = 1; + tdm_voutput_set_physical_size(voutput_info->voutput, voutput_info->mmwidth, voutput_info->mmheight); tdm_voutput_set_available_mode(voutput_info->voutput, voutput_info->available_modes.modes, voutput_info->available_modes.count); tdm_voutput_connect(voutput_info->voutput); + tdm_output_set_voutput_commit(voutput_info->voutput); } static void @@ -929,6 +933,11 @@ _tdm_voutput_cb_disconnect(struct wl_client *client, struct wl_resource *resourc 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_disconnect(voutput_info->voutput); } @@ -949,6 +958,9 @@ _tdm_voutput_cb_commit_done(struct wl_client *client, struct wl_resource *resour voutput_info->committing = 0; voutput_info->attach_buffer = NULL; + if (voutput_info->request_commit == 1) + tdm_output_set_voutput_commit(voutput_info->voutput); + tdm_voutput_commit_done(voutput_info->voutput); } @@ -1237,10 +1249,14 @@ tdm_voutput_cb_resource_destroy(struct wl_resource *resource) voutput = voutput_info->voutput; - if (voutput) + if (voutput_info->request_commit) + tdm_output_unset_voutput_commit(voutput_info->voutput); + + if (voutput) { ret = tdm_voutput_destroy(voutput); - if (ret != TDM_ERROR_NONE) - TDM_ERR("_tdm_voutput_cb_destroy fail"); + if (ret != TDM_ERROR_NONE) + TDM_ERR("_tdm_voutput_cb_destroy fail"); + } if (voutput_info->attach_buffer) { tbm_surface_h buffer = voutput_info->attach_buffer->buffer; -- 2.7.4 From 9b8f15d39d36eab50e1de2b4fc1b0213081353dc Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 26 Dec 2018 19:17:50 +0900 Subject: [PATCH 08/16] Package version up to 2.8.0 Change-Id: I6783f44b97e495b956a1f8187723a052b28f1b53 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 23e7273..2d07234 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.7.1 +Version: 2.8.0 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 10e641800daa2f4e8e4fcc0d3f0336674ee68bef Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 27 Dec 2018 17:31:30 +0900 Subject: [PATCH 09/16] fix typo Change-Id: I3cc0937b1b09007e1a76da8dfd16e5d0c25dac89 --- include/tdm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tdm.h b/include/tdm.h index 125ca56..0a2bcab 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -1051,7 +1051,7 @@ tdm_hwc_window_acquire_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error /** * @brief Release a buffer queue for the window object - * @details Release buffer queue when the client no longer uses buferrs of queue. + * @details Release buffer queue when the client no longer uses buffers of queue. * @param[in] hwc_window A window object * @param[in] A tbm buffer queue * @since 2.0.0 -- 2.7.4 From bff4891ead90b54d72722c22f72833ce749fa8dc Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 31 Dec 2018 12:44:59 +0900 Subject: [PATCH 10/16] client: documetation for voutput Change-Id: Icf6ebcb1a06ea4deff25e092143d769eab5514ab Signed-off-by: Junkyeong Kim --- client/tdm_client.h | 82 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 77 insertions(+), 5 deletions(-) diff --git a/client/tdm_client.h b/client/tdm_client.h index f8b2dec..7f5d247 100644 --- a/client/tdm_client.h +++ b/client/tdm_client.h @@ -440,43 +440,115 @@ unsigned int tdm_client_vblank_is_waiting(tdm_client_vblank *vblank); -/* Virtual Output */ +/** + * @brief Create the client voutput object which has the given name + * @param[in] client The TDM client object + * @param[in] name The name of the TDM client virtual output object + * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value. + * @return A client voutput object if success. Otherwise, NULL. + */ tdm_client_voutput * tdm_client_create_voutput(tdm_client *client, const char *name, tdm_error *error); +/** + * @brief Destroy the client voutput object + * @param[in] voutput The client voutput object + */ void tdm_client_voutput_destroy(tdm_client_voutput *voutput); +/** + * @brief Set the available mode info to the client voutput object + * @param[in] voutput The client voutput object + * @param[in] modes The array of available mode info + * @param[in] count The mode count + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_set_available_modes(tdm_client_voutput *voutput, const tdm_client_output_mode *modes, int count); +/** + * @brief Set the physical size info to the client voutput object + * @param[in] voutput The client voutput object + * @param[in] mmWidth The width of voutput + * @param[in] mmHeight The height of voutput + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_set_physical_size(tdm_client_voutput *voutput, unsigned int mmWidth, unsigned int mmHeight); +/** + * @brief Set the client voutput buffer commit handler + * @details The handler will be called when server send buffer. + * Client can get the committed buffer in the handler function. + * @param[in] voutput The client voutput object + * @param[in] func The user client voutput buffer commit handler + * @param[in] user_data The user_data + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_add_commit_handler(tdm_client_voutput *voutput, tdm_client_voutput_commit_handler func, void *user_data); +/** + * @brief Remove the client voutput buffer commit handler + * @param[in] voutput The client voutput object + * @param[in] func The user client voutput buffer commit handler + * @param[in] user_data The user_data + */ void tdm_client_voutput_remove_commit_handler(tdm_client_voutput *voutput, tdm_client_voutput_commit_handler func, void *user_data); -tdm_error -tdm_client_voutput_get_committed_tbm_surface(tdm_client_voutput *voutput, tbm_surface_h surface); - +/** + * @brief Send the commit done event to server + * @details + * After using the commited buffer which is get from commit handler + * have to send done event to server. + * @param[in] voutput The client voutput object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_commit_done(tdm_client_voutput *voutput); +/** + * @brief Get the client output object which was created by the given voutput object + * @details + * The client output object is made by voutput object. + * @param[in] voutput The client voutput object + * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value. + * @return A client output object if success. Otherwise, NULL. + */ tdm_client_output * tdm_client_voutput_get_client_output(tdm_client_voutput *voutput, tdm_error *error); +/** + * @brief Set the mode to the client voutput object + * details + * The client can set the mode of voutput object by send mode index. + * the index is the array number of available modes info. + * @param[in] voutput The client voutput object + * @param[in] modes The array of available mode info + * @param[in] index The index of avaliable modes + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_set_mode(tdm_client_voutput *voutput, int index); +/** + * @brief Set the client voutput object connected status + * @detail Send availabe_modes, physical size and connect info to the server. + * @param[in] voutput The client voutput object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_connect(tdm_client_voutput *voutput); +/** + * @brief Set the client voutput object disconnected status + * @param[in] voutput The client voutput object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_client_voutput_disconnect(tdm_client_voutput *voutput); -/* End of Virtual Output */ #ifdef __cplusplus } -- 2.7.4 From 7496e4d0e074a52d556163951198bc42d06bc41d Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 4 Jan 2019 16:36:03 +0900 Subject: [PATCH 11/16] tdm_server: fix voutput commit buffer double ref Change-Id: I0e45baf0c4585109ce5224a9df289a9cf82dfd9d Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index dc4f25a..4d3ad7c 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -1229,7 +1229,6 @@ tdm_voutput_commit_buffer(tdm_voutput *voutput) TDM_RETURN_VAL_IF_FAIL(voutput_info->attach_buffer != NULL, TDM_ERROR_OPERATION_FAILED); TDM_RETURN_VAL_IF_FAIL(voutput_info->committing == 0, TDM_ERROR_OPERATION_FAILED); - tbm_surface_internal_ref(voutput_info->attach_buffer->buffer); voutput_info->committing = 1; wl_tdm_voutput_send_commit(voutput_info->resource); -- 2.7.4 From 08b58ca9e23ae943687ce94eadfb7fc2097735b0 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 4 Jan 2019 16:37:26 +0900 Subject: [PATCH 12/16] tdm_server: execute voutput_disconnect when voutput destroy if voutput is connected Change-Id: Ia469a4c5c0a536010ecfc2137aff0d04fef5dcef Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tdm_server.c b/src/tdm_server.c index 4d3ad7c..4dfcdc1 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -1252,6 +1252,12 @@ tdm_voutput_cb_resource_destroy(struct wl_resource *resource) tdm_output_unset_voutput_commit(voutput_info->voutput); if (voutput) { + if (voutput_info->request_commit == 1) { + tdm_output_unset_voutput_commit(voutput_info->voutput); + voutput_info->request_commit = 0; + tdm_voutput_disconnect(voutput_info->voutput); + } + ret = tdm_voutput_destroy(voutput); if (ret != TDM_ERROR_NONE) TDM_ERR("_tdm_voutput_cb_destroy fail"); -- 2.7.4 From 48923ff22e1e920d712b032650f5de932e18a477 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 8 Jan 2019 13:30:01 +0900 Subject: [PATCH 13/16] virtual: treat unset buffer commit Change-Id: I41ad012b0fbbdc5ea22b6e1b50be38f8aa99c060 Signed-off-by: Junkyeong Kim --- backends/virtual/tdm_virtual_display.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backends/virtual/tdm_virtual_display.c b/backends/virtual/tdm_virtual_display.c index 2d407fe..e9e503f 100644 --- a/backends/virtual/tdm_virtual_display.c +++ b/backends/virtual/tdm_virtual_display.c @@ -459,6 +459,25 @@ virtual_output_commit(tdm_output *output, int sync, void *user_data) layer_data = output_data->primary_layer; + if (layer_data->display_buffer == NULL && layer_data->display_buffer_changed == 1) { + event_data = calloc(1, sizeof(tdm_virtual_event_data)); + if (!event_data) { + TDM_ERR("alloc failed"); + return TDM_ERROR_OUT_OF_MEMORY; + } + + event_data->type = TDM_VIRTUAL_EVENT_TYPE_COMMIT; + event_data->output_data = output_data; + event_data->user_data = user_data; + + ret = _tdm_virtual_display_wait_vblank(output_data, 3, event_data); + if (ret != TDM_ERROR_NONE) { + free(event_data); + return ret; + } + goto done; + } + if (voutput_data->vcommit_func) { if (layer_data->display_buffer_changed) { output_data->commit_user_data = user_data; @@ -496,6 +515,7 @@ virtual_output_commit(tdm_output *output, int sync, void *user_data) } } +done: layer_data->display_buffer_changed = 0; return TDM_ERROR_NONE; -- 2.7.4 From 7ad0e46a663a9312c65213f3d2ef785189ef2787 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 14 Jan 2019 18:51:54 +0900 Subject: [PATCH 14/16] tdm_hwc_window: fix the typo Change-Id: Ie98c84ff409839066ba8568ea60b80191a692dc5 --- src/tdm_hwc_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index 8f5fcda..1dd9e54 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -481,7 +481,7 @@ tdm_hwc_window_set_name(tdm_hwc_window *hwc_window, const char *name) private_module = private_output->private_module; func_hwc_window = &private_module->func_hwc_window; - if (!func_hwc_window->hwc_window_get_constraints) { + if (!func_hwc_window->hwc_window_set_name) { _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; -- 2.7.4 From 6eeb0de41fe29e626979bb1fd83588f59184d510 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 14 Jan 2019 19:58:55 +0900 Subject: [PATCH 15/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 16/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