From cffc8b39ddda18ef339799dfb64d53c0401b7aa3 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 2 Apr 2018 07:49:01 +0900 Subject: [PATCH 01/16] output: call output_change callbacks asynchronously Change-Id: I72a8460101efd8e12a109c465ecd8249890b7801 --- src/tdm_output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tdm_output.c b/src/tdm_output.c index 691d7bb..6543b7d 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -259,6 +259,7 @@ static tdm_error _tdm_output_call_thread_cb_status(tdm_private_output *private_output, tdm_output_conn_status status) { tdm_thread_cb_output_status output_status; + pid_t caller_tid = syscall(SYS_gettid); tdm_error ret; memset(&output_status, 0, sizeof output_status); @@ -266,7 +267,10 @@ _tdm_output_call_thread_cb_status(tdm_private_output *private_output, tdm_output output_status.base.length = sizeof output_status; output_status.base.object_stamp = private_output->stamp; output_status.base.data = NULL; - output_status.base.sync = 1; + if (tdm_thread_in_display_thread(caller_tid)) + output_status.base.sync = 0; + else + output_status.base.sync = 1; output_status.status = status; ret = tdm_thread_cb_call(private_output, &output_status.base, 1); -- 2.7.4 From eb4fcfa56a50de6b8bb7a0ca3906533d1a4593c1 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 2 Apr 2018 12:59:08 +0900 Subject: [PATCH 02/16] monitor: move to tools Change-Id: I251df596f253a71293ad16b76b280e1a0372c129 --- client/Makefile.am | 21 --------------------- tools/Makefile.am | 19 ++++++++++++++++++- {client => tools}/tdm_monitor.c | 0 3 files changed, 18 insertions(+), 22 deletions(-) rename {client => tools}/tdm_monitor.c (100%) diff --git a/client/Makefile.am b/client/Makefile.am index 859e2d3..d50c6b2 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -26,24 +26,3 @@ libtdm_client_la_SOURCES = \ $(top_srcdir)/protocol/tdm-protocol.c \ tdm_client.c -########################################################################## -### tdm-monitor -########################################################################## -bin_PROGRAMS = \ - tdm-monitor - -#tdm-monitor -tdm_monitor_SOURCES = \ - $(top_srcdir)/protocol/tdm-protocol.c \ - tdm_monitor.c -tdm_monitor_LDFLAGS = \ - -pie \ - ${LDFLAGS} -tdm_monitor_LDADD = $(TDM_CLIENT_LIBS) ../common/libtdm-common.la -tdm_monitor_CFLAGS = \ - -fPIE \ - $(CFLAGS) \ - $(TDM_CFLAGS) \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/protocol \ - -I$(top_srcdir)/src diff --git a/tools/Makefile.am b/tools/Makefile.am index d19e5e6..2f07236 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,6 +1,7 @@ bin_PROGRAMS = \ tdm-test-server \ - tdm-test-client + tdm-test-client \ + tdm-monitor #tdm-test-server tdm_test_server_SOURCES = \ @@ -33,3 +34,19 @@ tdm_test_client_CFLAGS = \ tdm_test_client_LDADD = \ $(TDM_LIBS) \ $(top_builddir)/client/libtdm-client.la + +#tdm-monitor +tdm_monitor_SOURCES = \ + $(top_srcdir)/protocol/tdm-protocol.c \ + tdm_monitor.c +tdm_monitor_LDFLAGS = \ + -pie \ + ${LDFLAGS} +tdm_monitor_LDADD = $(TDM_CLIENT_LIBS) ../common/libtdm-common.la +tdm_monitor_CFLAGS = \ + -fPIE \ + $(CFLAGS) \ + $(TDM_CFLAGS) \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/protocol \ + -I$(top_srcdir)/src diff --git a/client/tdm_monitor.c b/tools/tdm_monitor.c similarity index 100% rename from client/tdm_monitor.c rename to tools/tdm_monitor.c -- 2.7.4 From f2a5863445a2e5a34448bb02542a90d329ff4352 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 2 Apr 2018 13:55:28 +0900 Subject: [PATCH 03/16] config: move to src Change-Id: If7c889f1704be1c0aa0d8bbd2f4b5785368feb60 --- include/Makefile.am | 1 - packaging/libtdm.spec | 1 - {include => src}/tdm_config.h | 2 -- 3 files changed, 4 deletions(-) rename {include => src}/tdm_config.h (99%) diff --git a/include/Makefile.am b/include/Makefile.am index a16c981..0e0884a 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,7 +4,6 @@ libtdminclude_HEADERS = \ tdm_common.h \ tdm_types.h \ tdm_list.h \ - tdm_config.h \ tdm_log.h \ tdm_backend.h \ tdm_helper.h \ diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index a4c14d7..493b7b7 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -128,7 +128,6 @@ rm -f %{_unitdir_user}/basic.target.wants/tdm-socket-user.path %{_includedir}/tdm_list.h %{_includedir}/tdm_log.h %{_includedir}/tdm_types.h -%{_includedir}/tdm_config.h %{_includedir}/tdm_deprecated.h %{_libdir}/pkgconfig/libtdm.pc %{_libdir}/libtdm.so diff --git a/include/tdm_config.h b/src/tdm_config.h similarity index 99% rename from include/tdm_config.h rename to src/tdm_config.h index 1b1e36a..b6a34ba 100644 --- a/include/tdm_config.h +++ b/src/tdm_config.h @@ -49,8 +49,6 @@ extern "C" { * @brief The config header file for a frontend library */ -tdm_error -tdm_config_init(void); void tdm_config_deinit(void); -- 2.7.4 From e304b438166ecfce08fec402ffe1b9b855e54644 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 2 Apr 2018 15:37:57 +0900 Subject: [PATCH 04/16] thread: not reset find_funcs table when deinit tdm_thread_cb_call can be called after tdm_thread deinited. Change-Id: Ic58fd0a1c194e1f977f7b9c3b26017bbfed0a57a --- src/tdm_thread.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 2ca90a0..6ca28f2 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -291,15 +291,11 @@ tdm_thread_deinit(tdm_private_loop *private_loop) tdm_private_display *private_display; tdm_private_thread_cb *cb = NULL, *hh = NULL; tdm_error ret; - int i; TDM_RETURN_IF_FAIL(TDM_MUTEX_IS_LOCKED()); - if (!private_loop->private_thread) { - for (i = 0; i < TDM_THREAD_CB_MAX; i++) - find_funcs[i] = NULL; + if (!private_loop->private_thread) return; - } ret = _tdm_thread_exit(private_loop); if (ret != TDM_ERROR_NONE) @@ -344,9 +340,6 @@ tdm_thread_deinit(tdm_private_loop *private_loop) private_loop->private_thread = NULL; keep_private_thread = NULL; - for (i = 0; i < TDM_THREAD_CB_MAX; i++) - find_funcs[i] = NULL; - TDM_INFO("Finish a TDM event thread"); } -- 2.7.4 From 4abfab3661147e28398df7be7b35f3cf7973be8f Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 2 Apr 2018 15:51:42 +0900 Subject: [PATCH 05/16] thread: only allow a sync event from tdm-thread to display-thread A sync-type event from display-thread to tdm-thread can't be handled. If sync-type events happen in both threads at the same time, it would make a deadlock issue. Change-Id: Ic45207a173dfe9413f419506da1a6d36e86d06e3 --- src/tdm_thread.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tdm_thread.c b/src/tdm_thread.c index 6ca28f2..ea891a2 100644 --- a/src/tdm_thread.c +++ b/src/tdm_thread.c @@ -640,16 +640,18 @@ tdm_thread_cb_call(void *object, tdm_thread_cb_base *cb_base, unsigned int propa assert(find_funcs[cb_base->type] != NULL); + if (keep_private_thread && keep_private_thread->thread_tid != caller_tid) { + /* A sync-type event from display-thread to tdm-thread can't be handled. + * If sync-type events happen in both threads at the same time, + * it would make a deadlock issue. + */ + assert(cb_base->sync != 1); + } + if (tdm_debug_module & TDM_DEBUG_THREAD) TDM_INFO("'%s' thread_cb (sync:%d, propagation:%d) ------", tdm_cb_type_str(cb_base->type), cb_base->sync, propagation); - /* handling only output-status as sync. below logic can't handle two sync-type events */ - if (cb_base->type == TDM_THREAD_CB_OUTPUT_STATUS) - assert(cb_base->sync == 1); - else - assert(cb_base->sync == 0); - if (!object) { object = find_funcs[cb_base->type](private_display, cb_base->object_stamp); if (!object) { -- 2.7.4 From 782d100ad830459baaee9f46b179fd4998e80607 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 16:26:13 +0900 Subject: [PATCH 06/16] add plantuml, dot files Change-Id: I99569149d5b46722426a97e8f59e39fa3db526bc --- doc/tdm_header.txt | 109 ++++++++++++++++++++++++++++++++++++++++++++ doc/tdm_thread.txt | 40 ++++++++++++++++ doc/tdm_thread_deadlock.txt | 40 ++++++++++++++++ 3 files changed, 189 insertions(+) create mode 100644 doc/tdm_header.txt create mode 100644 doc/tdm_thread.txt create mode 100644 doc/tdm_thread_deadlock.txt diff --git a/doc/tdm_header.txt b/doc/tdm_header.txt new file mode 100644 index 0000000..59c3cef --- /dev/null +++ b/doc/tdm_header.txt @@ -0,0 +1,109 @@ +#dot -Tpng a.dot -o a.png + +digraph G +{ + compound=true; + nodesep=0.2; + ranksep=0.5; + node [fontname=Courier,fontsize=10,width=0,height=0,shape=box]; + + { + node [fontname=Courier,fontsize=10,shape=plaintext,color=white]; + edge [style=invis]; + Lv0 -> Lv1 -> Lv2 -> Lv3 -> Lv4 -> Lv5 -> Lv6; + } + + { + rank=same; + Lv0; + "tdm_common.h"; + } + + { + rank=same; + Lv1; + + "tdm_types.h"; + "tdm_client_types.h"; + } + + { + rank=same; + Lv2; + + "tdm_list.h"; + "tdm_log.h"; + "tdm_helper.h"; + "tdm.h"; + "tdm_backend.h"; + "tdm_client.h"; + } + + { + rank=same; + Lv3; + + "tdm_private_types.h"; + } + + { + rank=same; + Lv4; + + "tdm_config.h"; + "tdm_thread.h"; + } + + + { + rank=same; + Lv5; + + "tdm_macro.h"; + } + + + { + rank=same; + Lv6; + + "tdm_private.h"; + } + + "tdm_list.h" [style="filled",fillcolor=gold]; + "tdm_log.h" [style="filled",fillcolor=gold]; + "tdm_helper.h" [style="filled",fillcolor=gold]; + + "tdm_private.h" [style="filled",fillcolor=grey]; + "tdm_private_types.h" [style="filled",fillcolor=grey]; + "tdm_config.h" [style="filled",fillcolor=grey]; + "tdm_macro.h" [style="filled",fillcolor=grey]; + "tdm_thread.h" [style="filled",fillcolor=grey]; + + "tdm_backend.h" [style="filled",fillcolor=darkorchid1]; + "tdm.h" [style="filled",fillcolor=cornflowerblue]; + + "tdm_client.h" [style="filled",fillcolor= skyblue]; + + "tdm_client_types.h" -> "tdm_common.h"; + "tdm_client.h" -> "tdm_client_types.h"; + "tdm_types.h" -> "tdm_common.h"; + "tdm.h" -> "tdm_types.h"; + "tdm_helper.h" -> "tdm_types.h"; + "tdm_backend.h" -> "tdm_types.h"; + "tdm_macro.h" -> "tdm_private_types.h"; + "tdm_macro.h" -> "tdm_thread.h"; + "tdm_thread.h" -> "tdm_private_types.h"; + "tdm_private_types.h" -> "tdm_types.h"; + "tdm_private_types.h" -> "tdm_list.h"; + "tdm_private_types.h" -> "tdm_log.h"; + "tdm_private_types.h" -> "tdm_backend.h"; + "tdm_config.h" -> "tdm_private_types.h"; + "tdm_private.h" -> "tdm_private_types.h"; + "tdm_private.h" -> "tdm_macro.h"; + "tdm_private.h" -> "tdm_helper.h"; + "tdm_private.h" -> "tdm_config.h"; + "tdm_private.h" -> "tdm_thread.h"; + + "tdm_private_types.h" -> "tdm.h"; +} diff --git a/doc/tdm_thread.txt b/doc/tdm_thread.txt new file mode 100644 index 0000000..5e6f28f --- /dev/null +++ b/doc/tdm_thread.txt @@ -0,0 +1,40 @@ +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +== an asynchronous event == +sub <-- : an asynchronous event +activate sub + sub -> sub: calling thread callbacks in tdm-thread + activate sub + deactivate sub + main <-- sub: sending an asynchronous event +deactivate sub +activate main +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +deactivate main + +== a synchronous event == +sub <-- : a synchronous event +activate sub + sub -> sub: calling thread callbacks in tdm-thread + activate sub + deactivate sub + sub --> main: sending a synchronous event + activate main + sub -> sub: pthread_cond_wait + activate sub + main -> main: calling thread callbacks in main-thread + activate main + deactivate main + main --> sub: pthread_cond_signal + deactivate sub + deactivate main +deactivate sub + +@enduml diff --git a/doc/tdm_thread_deadlock.txt b/doc/tdm_thread_deadlock.txt new file mode 100644 index 0000000..3a01697 --- /dev/null +++ b/doc/tdm_thread_deadlock.txt @@ -0,0 +1,40 @@ +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +sub <-- : a synchronous event +activate sub +--> main: a synchronous event +activate main +sub -> sub: calling thread callbacks in tdm-thread +activate sub +deactivate sub +sub --> main: sending a synchronous event +sub -> sub: pthread_cond_wait +activate sub +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +main --> sub: sending a synchronous event +main -> main: pthread_cond_wait +activate main +deactivate sub +deactivate main +deactivate main +deactivate sub + +... (DEADLOCK) ... +note over main, sub + * 만약 main-thread, tdm-thread에서 동시에 synchronous event가 발생되게 되면 deadlock발생됨 + - 양쪽에서 모두 pthread_cond_wait에서 대기 + * sync event는 한쪽 thread에서만 발생되도록 보장되어야 함. + - tdm-thread -> main-thread방향으로만 sync event전달만 허용 + * sync event의 종류 + - backend에서 스스로 발생되는 event들만 가능 + - output status변경중에 connection/disconnection, virtual output creation/destruction +end note + +@enduml -- 2.7.4 From 04ab8db6936dfb9a5d1f91a7ab3ccf78f13d0af0 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 16:46:34 +0900 Subject: [PATCH 07/16] config: not export tdm_config function to backend Change-Id: I2c8d162912c0971e6be5443c18535df81055eca7 --- include/tdm_backend.h | 22 ---------------------- src/tdm_config.h | 38 ++++++++++++++++++++++++++++++++++++-- src/tdm_private.h | 3 +++ 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 970cbc4..0416a90 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -1443,28 +1443,6 @@ tdm_event_loop_source_timer_update(tdm_event_loop_source *source, unsigned int m void tdm_event_loop_source_remove(tdm_event_loop_source *source); -/** - * @brief Get the ini value with given key - * @details - * @param[in] key The given key - * @param[in] default_value The default value - * @return the value of given key if success. Otherwise, default_value. - * @see #tdm_config_get_string - */ -int -tdm_config_get_int(const char *key, int default_value); - -/** - * @brief Get the ini value with given key - * @details - * @param[in] key The given key - * @param[in] default_value The default value - * @return the value of given key if success. Otherwise, default_value. - * @see #tdm_config_get_int - */ -const char * -tdm_config_get_string(const char *key, const char *default_value); - /** * @brief Trigger a 'need to validate' event. diff --git a/src/tdm_config.h b/src/tdm_config.h index b6a34ba..73eeb9f 100644 --- a/src/tdm_config.h +++ b/src/tdm_config.h @@ -49,11 +49,45 @@ extern "C" { * @brief The config header file for a frontend library */ -void -tdm_config_deinit(void); +/** + * @brief Get the ini value with given key + * @details + * @param[in] key The given key + * @param[in] default_value The default value + * @return the value of given key if success. Otherwise, default_value. + * @see #tdm_config_get_string + */ +int +tdm_config_get_int(const char *key, int default_value); + +/** + * @brief Get the ini value with given key + * @details + * @param[in] key The given key + * @param[in] default_value The default value + * @return the value of given key if success. Otherwise, default_value. + * @see #tdm_config_get_int + */ +const char * +tdm_config_get_string(const char *key, const char *default_value); +/** + * @brief Set the ini value with given key + * @details + * @param[in] key The given key + * @param[in] value The value + * @return TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_config_set_int(const char *key, int value); + +/** + * @brief Set the ini value with given key + * @details + * @param[in] key The given key + * @param[in] value The value + * @return TDM_ERROR_NONE if success. Otherwise, error value. + */ tdm_error tdm_config_set_string(const char *key, const char *value); diff --git a/src/tdm_private.h b/src/tdm_private.h index 9b1951d..40f9e79 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -238,6 +238,9 @@ tdm_error tdm_display_enable_fps(tdm_private_display *private_display, int enable); void +tdm_config_deinit(void); + +void tdm_monitor_server_command(tdm_display *dpy, const char *options, char *reply, int *len); #ifdef __cplusplus -- 2.7.4 From 46142c8a75ff9d1008abab34f090d79600658ba7 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 17:04:00 +0900 Subject: [PATCH 08/16] doc: fix carriage return Change-Id: I850997b73174ff25e60b59c33e52b0b8cb89d1bc --- doc/tdm_thread.txt | 80 ++++++++++++++++++++++----------------------- doc/tdm_thread_deadlock.txt | 71 ++++++++++++++++++---------------------- 2 files changed, 71 insertions(+), 80 deletions(-) diff --git a/doc/tdm_thread.txt b/doc/tdm_thread.txt index 5e6f28f..71bf7a3 100644 --- a/doc/tdm_thread.txt +++ b/doc/tdm_thread.txt @@ -1,40 +1,40 @@ -@startuml - -hide footbox - -participant "E20 main thread" as main -participant "tdm thread" as sub - -== an asynchronous event == -sub <-- : an asynchronous event -activate sub - sub -> sub: calling thread callbacks in tdm-thread - activate sub - deactivate sub - main <-- sub: sending an asynchronous event -deactivate sub -activate main -main -> main: calling thread callbacks in main-thread -activate main -deactivate main -deactivate main - -== a synchronous event == -sub <-- : a synchronous event -activate sub - sub -> sub: calling thread callbacks in tdm-thread - activate sub - deactivate sub - sub --> main: sending a synchronous event - activate main - sub -> sub: pthread_cond_wait - activate sub - main -> main: calling thread callbacks in main-thread - activate main - deactivate main - main --> sub: pthread_cond_signal - deactivate sub - deactivate main -deactivate sub - -@enduml +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +== an asynchronous event == +sub <-- : an asynchronous event +activate sub +sub -> sub: calling thread callbacks in tdm-thread +activate sub +deactivate sub +main <-- sub: sending an asynchronous event +deactivate sub +activate main +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +deactivate main + +== a synchronous event == +sub <-- : a synchronous event +activate sub +sub -> sub: calling thread callbacks in tdm-thread +activate sub +deactivate sub +sub --> main: sending a synchronous event +activate main +sub -> sub: pthread_cond_wait +activate sub +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +main --> sub: pthread_cond_signal +deactivate sub +deactivate main +deactivate sub + +@enduml diff --git a/doc/tdm_thread_deadlock.txt b/doc/tdm_thread_deadlock.txt index 3a01697..85cca6f 100644 --- a/doc/tdm_thread_deadlock.txt +++ b/doc/tdm_thread_deadlock.txt @@ -1,40 +1,31 @@ -@startuml - -hide footbox - -participant "E20 main thread" as main -participant "tdm thread" as sub - -sub <-- : a synchronous event -activate sub ---> main: a synchronous event -activate main -sub -> sub: calling thread callbacks in tdm-thread -activate sub -deactivate sub -sub --> main: sending a synchronous event -sub -> sub: pthread_cond_wait -activate sub -main -> main: calling thread callbacks in main-thread -activate main -deactivate main -main --> sub: sending a synchronous event -main -> main: pthread_cond_wait -activate main -deactivate sub -deactivate main -deactivate main -deactivate sub - -... (DEADLOCK) ... -note over main, sub - * 만약 main-thread, tdm-thread에서 동시에 synchronous event가 발생되게 되면 deadlock발생됨 - - 양쪽에서 모두 pthread_cond_wait에서 대기 - * sync event는 한쪽 thread에서만 발생되도록 보장되어야 함. - - tdm-thread -> main-thread방향으로만 sync event전달만 허용 - * sync event의 종류 - - backend에서 스스로 발생되는 event들만 가능 - - output status변경중에 connection/disconnection, virtual output creation/destruction -end note - -@enduml +@startuml + +hide footbox + +participant "E20 main thread" as main +participant "tdm thread" as sub + +sub <-- : a synchronous event +activate sub +--> main: a synchronous event +activate main +sub -> sub: calling thread callbacks in tdm-thread +activate sub +deactivate sub +sub --> main: sending a synchronous event +sub -> sub: pthread_cond_wait +activate sub +main -> main: calling thread callbacks in main-thread +activate main +deactivate main +main --> sub: sending a synchronous event +main -> main: pthread_cond_wait +activate main +deactivate sub +deactivate main +deactivate main +deactivate sub + +... (DEADLOCK) ... + +@enduml -- 2.7.4 From aa70cc4a91cfcc516231964af272bbe6299d9490 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 17:04:40 +0900 Subject: [PATCH 09/16] doc: update dot file Change-Id: I6cfe80a55147c2bf9ef22b4e095c2c2607dc43b0 --- doc/tdm_header.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tdm_header.txt b/doc/tdm_header.txt index 59c3cef..37be79c 100644 --- a/doc/tdm_header.txt +++ b/doc/tdm_header.txt @@ -98,7 +98,7 @@ digraph G "tdm_private_types.h" -> "tdm_list.h"; "tdm_private_types.h" -> "tdm_log.h"; "tdm_private_types.h" -> "tdm_backend.h"; - "tdm_config.h" -> "tdm_private_types.h"; + "tdm_config.h" -> "tdm_common.h"; "tdm_private.h" -> "tdm_private_types.h"; "tdm_private.h" -> "tdm_macro.h"; "tdm_private.h" -> "tdm_helper.h"; -- 2.7.4 From 96d1f3519412969af72a04bc4ebf811911310011 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Tue, 3 Apr 2018 17:24:03 +0900 Subject: [PATCH 10/16] event_loop: destroy clients before destroying display Change-Id: I6e143aa8446d6cd1e3c5567604dac227b647d6fe --- src/tdm_event_loop.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tdm_event_loop.c b/src/tdm_event_loop.c index 2e7fbbd..b7de4ab 100644 --- a/src/tdm_event_loop.c +++ b/src/tdm_event_loop.c @@ -162,6 +162,10 @@ tdm_event_loop_deinit(tdm_private_display *private_display) tdm_event_loop_source_remove(source); } +#if WAYLAND_VERSION_MAJOR >= 1 && WAYLAND_VERSION_MINOR >= 15 + wl_display_destroy_clients(private_display->private_loop->wl_display); +#endif + wl_display_destroy(private_display->private_loop->wl_display); free(private_display->private_loop); -- 2.7.4 From 929734f3059260852503ec3f34304e471d31b23d Mon Sep 17 00:00:00 2001 From: Boram Park Date: Fri, 6 Apr 2018 16:38:59 +0900 Subject: [PATCH 11/16] utests: add excluding coverage comments Change-Id: I8533054065c261c059294bc3f8101f64d1623ab3 --- utests/src/ut_tdm.h | 4 +++ utests/src/ut_tdm_backend_capture.cpp | 3 ++ utests/src/ut_tdm_backend_display.cpp | 4 +++ utests/src/ut_tdm_backend_env.cpp | 4 +++ utests/src/ut_tdm_backend_pp.cpp | 4 +++ utests/src/ut_tdm_buffer.cpp | 4 +++ utests/src/ut_tdm_client.cpp | 67 +++++++++++++++++++++++++++++------ utests/src/ut_tdm_display.cpp | 24 ++++++++++++- utests/src/ut_tdm_env.cpp | 4 +++ utests/src/ut_tdm_event_loop.cpp | 4 +++ utests/src/ut_tdm_helper.cpp | 4 +++ utests/src/ut_tdm_hwc_window.cpp | 6 +++- utests/src/ut_tdm_layer.cpp | 4 +++ utests/src/ut_tdm_log.cpp | 3 ++ utests/src/ut_tdm_main.cpp | 6 +++- utests/src/ut_tdm_output.cpp | 6 +++- utests/src/ut_tdm_output_hwc.cpp | 4 +++ utests/src/ut_tdm_vblank.cpp | 24 ++++++++++++- 18 files changed, 163 insertions(+), 16 deletions(-) diff --git a/utests/src/ut_tdm.h b/utests/src/ut_tdm.h index 63662e1..b7265fa 100644 --- a/utests/src/ut_tdm.h +++ b/utests/src/ut_tdm.h @@ -18,6 +18,8 @@ extern "C" { #include } +/* LCOV_EXCL_START */ + #include "tdm.h" #include "tdm_helper.h" #include "tdm_config.h" @@ -255,4 +257,6 @@ char ut_tdm_backend_getchar(void); } \ } while (0) +/* LCOV_EXCL_STOP */ + #endif // _UT_TDM_H_ diff --git a/utests/src/ut_tdm_backend_capture.cpp b/utests/src/ut_tdm_backend_capture.cpp index 07a1033..8eca5d6 100644 --- a/utests/src/ut_tdm_backend_capture.cpp +++ b/utests/src/ut_tdm_backend_capture.cpp @@ -30,6 +30,7 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ class TDMBackendCapture : public TDMBackendDisplay { public: @@ -1078,3 +1079,5 @@ INSTANTIATE_TEST_CASE_P(TDMBackendCaptureParams, TDMBackendCapture, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_backend_display.cpp b/utests/src/ut_tdm_backend_display.cpp index b0afa59..a5dd08e 100644 --- a/utests/src/ut_tdm_backend_display.cpp +++ b/utests/src/ut_tdm_backend_display.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + #define TDM_UT_BACKEND_TEST_CNT 20 TDMBackendBasic::TDMBackendBasic() @@ -1427,3 +1429,5 @@ INSTANTIATE_TEST_CASE_P(TDMBackendDisplayParams, TDMBackendDisplay, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_backend_env.cpp b/utests/src/ut_tdm_backend_env.cpp index 4c9bbbf..72a7f92 100644 --- a/utests/src/ut_tdm_backend_env.cpp +++ b/utests/src/ut_tdm_backend_env.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + bool enable_porting_debug = false; void TDMBackendEnv::SetUp(void) @@ -77,3 +79,5 @@ INSTANTIATE_TEST_CASE_P(TDMBackendEnvParams, TDMBackendEnv, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_backend_pp.cpp b/utests/src/ut_tdm_backend_pp.cpp index 794046c..d7545ac 100644 --- a/utests/src/ut_tdm_backend_pp.cpp +++ b/utests/src/ut_tdm_backend_pp.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + class TDMBackendPP : public TDMBackendDisplay { public: @@ -854,3 +856,5 @@ INSTANTIATE_TEST_CASE_P(TDMBackendPPParams, TDMBackendPP, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_buffer.cpp b/utests/src/ut_tdm_buffer.cpp index 10ec508..ec03dba 100644 --- a/utests/src/ut_tdm_buffer.cpp +++ b/utests/src/ut_tdm_buffer.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + class TDMBuffer : public TDMDisplay { public: @@ -293,3 +295,5 @@ INSTANTIATE_TEST_CASE_P(TDMBufferParams, TDMBuffer, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_client.cpp b/utests/src/ut_tdm_client.cpp index b44ef46..e72510a 100644 --- a/utests/src/ut_tdm_client.cpp +++ b/utests/src/ut_tdm_client.cpp @@ -38,6 +38,8 @@ #include "ut_tdm.h" #include "tdm_client.h" +/* LCOV_EXCL_START */ + enum { TDM_UT_PIPE_MSG_NONE, TDM_UT_PIPE_MSG_REPLY, @@ -452,25 +454,31 @@ TEST_P(TDMClient, ClientGetFdNullOther) ASSERT_EQ(tdm_client_get_fd(client, NULL), TDM_ERROR_INVALID_PARAMETER); } +static void +_ut_tdm_client_vblank_cb(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data) +{ + bool *done = (bool *)user_data; + if (done) + *done = true; +} + /* tdm_client_handle_events_timeout */ -TEST_P(TDMClient, DISABLED_ClientHandleEvent) +TEST_P(TDMClient, ClientHandleEvent) { + bool done = false; + ASSERT_EQ(PrepareClient(), true); -// ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE); -} + ASSERT_EQ(tdm_client_wait_vblank(client, NULL, 1, 1, 0, _ut_tdm_client_vblank_cb, &done), TDM_ERROR_NONE); + ASSERT_EQ(done, false); -TEST_P(TDMClient, ClientHandleEventNullObject) -{ - ASSERT_EQ(tdm_client_handle_events_timeout(NULL, 3000), TDM_ERROR_INVALID_PARAMETER); + while (!done) + ASSERT_EQ(tdm_client_handle_events(client), TDM_ERROR_NONE); } -static void -_ut_tdm_client_vblank_cb(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data) +TEST_P(TDMClient, ClientHandleEventNullObject) { - bool *done = (bool *)user_data; - if (done) - *done = true; + ASSERT_EQ(tdm_client_handle_events(NULL), TDM_ERROR_INVALID_PARAMETER); } /* tdm_client_wait_vblank, deprecated */ @@ -1315,6 +1323,41 @@ TEST_P(TDMClient, ClientVblankWaitSetEnableFakeDpmsOff) ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); } +/* tdm_client_vblank_wait */ +TEST_P(TDMClient, ClientVblankIsWaiting) +{ + bool done; + unsigned int waiting; + + ASSERT_EQ(PrepareClient(), true); + ASSERT_EQ(PrepareOutput(), true); + ASSERT_EQ(PrepareVblank(), true); + + done = false; + ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, &done), TDM_ERROR_NONE); + + waiting = tdm_client_vblank_is_waiting(vblank); + ASSERT_EQ(waiting, 1); + + start = tdm_helper_get_time(); + while (!done) + ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE); + end = tdm_helper_get_time(); + + /* "+ vrefresh_interval" consider the delay of socket communication between kernel and platform */ + ASSERT_LT((end - start), (vrefresh_interval + vrefresh_interval)); + + waiting = tdm_client_vblank_is_waiting(vblank); + ASSERT_EQ(waiting, 0); +} + +/* tdm_client_vblank_wait */ +TEST_P(TDMClient, ClientVblankIsWaitingNullObject) +{ + unsigned int waiting = tdm_client_vblank_is_waiting(NULL); + ASSERT_EQ(waiting, 0); +} + #ifdef TDM_UT_TEST_WITH_PARAMS INSTANTIATE_TEST_CASE_P(TDMClientParams, TDMClient, @@ -1324,3 +1367,5 @@ INSTANTIATE_TEST_CASE_P(TDMClientParams, TDMClient, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_display.cpp b/utests/src/ut_tdm_display.cpp index 1548a5e..2476999 100644 --- a/utests/src/ut_tdm_display.cpp +++ b/utests/src/ut_tdm_display.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + TDMDisplay::TDMDisplay() { dpy = NULL; @@ -368,6 +370,24 @@ TEST_P(TDMDisplay, DisplayGetOutputWrongIndex) ASSERT_EQ(output, NULL); } +TEST_P(TDMDisplay, DisplayFindOutput) +{ + tdm_output *output; + int count = TDM_UT_INVALID_VALUE; + tdm_error ret; + + ASSERT_EQ(tdm_display_get_output_count(dpy, &count), TDM_ERROR_NONE); + ASSERT_GT(count, 0); + + output = tdm_display_find_output(dpy, "primary", &ret); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ASSERT_NE(output, NULL); + + output = tdm_display_find_output(dpy, "invalid", &ret); + ASSERT_EQ(ret, TDM_ERROR_NONE); + ASSERT_EQ(output, NULL); +} + TEST_P(TDMDisplay, DisplayCreatePp) { tdm_pp *pp; @@ -474,4 +494,6 @@ INSTANTIATE_TEST_CASE_P(TDMDisplayParams, INSTANTIATE_TEST_CASE_P(TDMDisplayParams, TDMDisplay, Values(TDM_DEFAULT_MODULE)); -#endif \ No newline at end of file +#endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_env.cpp b/utests/src/ut_tdm_env.cpp index 25915aa..e773e39 100644 --- a/utests/src/ut_tdm_env.cpp +++ b/utests/src/ut_tdm_env.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + void TDMEnv::SetUp(void) { const char *test_backend; @@ -152,3 +154,5 @@ INSTANTIATE_TEST_CASE_P(TDMEnvParams, TDMEnv, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_event_loop.cpp b/utests/src/ut_tdm_event_loop.cpp index 3fffecb..d7f5b6a 100644 --- a/utests/src/ut_tdm_event_loop.cpp +++ b/utests/src/ut_tdm_event_loop.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + class TDMEventLoop : public TDMDisplay { public: @@ -218,3 +220,5 @@ INSTANTIATE_TEST_CASE_P(TDMEventLoopParams, TDMEventLoop, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_helper.cpp b/utests/src/ut_tdm_helper.cpp index b9ad342..5aa34b1 100644 --- a/utests/src/ut_tdm_helper.cpp +++ b/utests/src/ut_tdm_helper.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + class TDMHelper : public TDMOutput { public: @@ -508,3 +510,5 @@ INSTANTIATE_TEST_CASE_P(TDMHelperParams, TDMHelper, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_hwc_window.cpp b/utests/src/ut_tdm_hwc_window.cpp index 23bae31..12be19c 100644 --- a/utests/src/ut_tdm_hwc_window.cpp +++ b/utests/src/ut_tdm_hwc_window.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + #define HWC_WIN_NUM 5 class TDMHwcWindow : public TDMOutput @@ -468,4 +470,6 @@ INSTANTIATE_TEST_CASE_P(TDMHwcWindowParams, INSTANTIATE_TEST_CASE_P(TDMHwcWindowParams, TDMHwcWindow, Values(TDM_DEFAULT_MODULE)); -#endif \ No newline at end of file +#endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_layer.cpp b/utests/src/ut_tdm_layer.cpp index d178de7..d1eb318 100644 --- a/utests/src/ut_tdm_layer.cpp +++ b/utests/src/ut_tdm_layer.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + #define BORDER_SIZE 20 class TDMLayer : public TDMOutput @@ -1500,3 +1502,5 @@ INSTANTIATE_TEST_CASE_P(TDMLayerParams, TDMLayer, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_log.cpp b/utests/src/ut_tdm_log.cpp index e8fee79..e399742 100644 --- a/utests/src/ut_tdm_log.cpp +++ b/utests/src/ut_tdm_log.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + TEST(TDMLog, logPrintf) { tdm_log_enable_color(1); @@ -86,3 +88,4 @@ TEST(TDMLog, logDlogUnknownLevel) tdm_log_print(TDM_UT_INVALID_VALUE, "utest"); } +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_main.cpp b/utests/src/ut_tdm_main.cpp index 8ed5556..bc1b1bc 100644 --- a/utests/src/ut_tdm_main.cpp +++ b/utests/src/ut_tdm_main.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + int tdm_debug_module; int main(int argc, char **argv) @@ -61,4 +63,6 @@ int main(int argc, char **argv) #endif return AllTestSuccess; -} \ No newline at end of file +} + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_output.cpp b/utests/src/ut_tdm_output.cpp index 227b3e2..2559517 100644 --- a/utests/src/ut_tdm_output.cpp +++ b/utests/src/ut_tdm_output.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + static void _ut_tdm_output_change_cb(tdm_output *output, tdm_output_change_type type, tdm_value value, void *user_data); static void _ut_tdm_output_change_cb2(tdm_output *output, tdm_output_change_type type, tdm_value value, void *user_data); @@ -1708,4 +1710,6 @@ INSTANTIATE_TEST_CASE_P(TDMOutputParams, INSTANTIATE_TEST_CASE_P(TDMOutputParams, TDMOutput, Values(TDM_DEFAULT_MODULE)); -#endif \ No newline at end of file +#endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_output_hwc.cpp b/utests/src/ut_tdm_output_hwc.cpp index d99b0a0..e84860d 100644 --- a/utests/src/ut_tdm_output_hwc.cpp +++ b/utests/src/ut_tdm_output_hwc.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + class TDMOutputHwc : public TDMOutput { public: @@ -449,3 +451,5 @@ INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams, TDMOutputHwc, Values(TDM_DEFAULT_MODULE)); #endif + +/* LCOV_EXCL_END */ \ No newline at end of file diff --git a/utests/src/ut_tdm_vblank.cpp b/utests/src/ut_tdm_vblank.cpp index b9ae767..5a6584c 100644 --- a/utests/src/ut_tdm_vblank.cpp +++ b/utests/src/ut_tdm_vblank.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +/* LCOV_EXCL_START */ + static void _ut_tdm_vblank_create_cb(tdm_vblank *vblank, void *user_data); static void _ut_tdm_vblank_create_cb2(tdm_vblank *vblank, void *user_data); @@ -1409,6 +1411,24 @@ TEST_P(TDMVblank, DISABLED_VblankWaitBeforeDpmsOff) /* wait vblank -> dpms off -> then? (vblank handler is called? or not?) */ } +TEST_P(TDMVblank, VblankWaitTimeout) +{ + TDM_UT_SKIP_FLAG(has_outputs); + + ASSERT_EQ(TestPrepareOutput(), true); + ASSERT_EQ(TestCreateVblanks(), true); + + if (vblank_count > 0) { + tdm_vblank *vblank = vblanks[0]; + unsigned int cur_seq = 0; + + ASSERT_EQ(tdm_vblank_wait(vblank, 0, 0, 1, _ut_tdm_vblank_cb, &cur_seq), TDM_ERROR_NONE); + usleep(1200000); + while (cur_seq == 0) + ASSERT_EQ(ut_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + } +} + #ifdef TDM_UT_TEST_WITH_PARAMS INSTANTIATE_TEST_CASE_P(TDMVblankParams, TDMVblank, @@ -1417,4 +1437,6 @@ INSTANTIATE_TEST_CASE_P(TDMVblankParams, INSTANTIATE_TEST_CASE_P(TDMVblankParams, TDMVblank, Values(TDM_DEFAULT_MODULE)); -#endif \ No newline at end of file +#endif + +/* LCOV_EXCL_END */ \ No newline at end of file -- 2.7.4 From 44b1aa829d5b6c774925b596c6161a630aa3f4d4 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Fri, 6 Apr 2018 16:40:25 +0900 Subject: [PATCH 12/16] common: add excluding coverage comments Change-Id: I3608620a3fd494a1416dfb53df057241e074f114 --- src/tdm_backend.c | 4 ++++ src/tdm_display.c | 2 ++ src/tdm_hwc_window.c | 49 +++---------------------------------------------- src/tdm_macro.h | 2 ++ src/tdm_output.c | 42 ++---------------------------------------- 5 files changed, 13 insertions(+), 86 deletions(-) diff --git a/src/tdm_backend.c b/src/tdm_backend.c index 238d085..8be51f0 100644 --- a/src/tdm_backend.c +++ b/src/tdm_backend.c @@ -131,6 +131,7 @@ tdm_backend_register_func_layer(tdm_display *dpy, tdm_func_layer *func_layer) return TDM_ERROR_NONE; } +/* LCOV_EXCL_START */ EXTERN tdm_error tdm_backend_register_func_hwc_window(tdm_display *dpy, tdm_func_hwc_window *func_hwc_window) { @@ -155,6 +156,7 @@ tdm_backend_register_func_hwc_window(tdm_display *dpy, tdm_func_hwc_window *func return TDM_ERROR_NONE; } +/* LCOV_EXCL_STOP */ EXTERN tdm_error tdm_backend_register_func_pp(tdm_display *dpy, tdm_func_pp *func_pp) @@ -204,6 +206,7 @@ tdm_backend_register_func_capture(tdm_display *dpy, return TDM_ERROR_NONE; } +/* LCOV_EXCL_START */ /* backend operates itself types */ static tdm_private_output* _look_for_frontend_hwc_output(tdm_output *backend_output) @@ -247,3 +250,4 @@ tdm_backend_trigger_need_validate_event(tdm_output *output) return TDM_ERROR_NONE; } +/* LCOV_EXCL_STOP */ diff --git a/src/tdm_display.c b/src/tdm_display.c index d2fcde4..9f66167 100644 --- a/src/tdm_display.c +++ b/src/tdm_display.c @@ -61,6 +61,7 @@ private_module = (tdm_private_module*)module; \ private_display = private_module->private_display; +/* LCOV_EXCL_START */ INTERN tdm_error tdm_display_enable_debug_module(const char*modules) { @@ -346,6 +347,7 @@ tdm_display_enable_fps(tdm_private_display *private_display, int enable) return TDM_ERROR_NONE; } +/* LCOV_EXCL_STOP */ EXTERN tdm_error tdm_display_get_capabilities(tdm_display *dpy, diff --git a/src/tdm_hwc_window.c b/src/tdm_hwc_window.c index c3619ed..8ef8042 100644 --- a/src/tdm_hwc_window.c +++ b/src/tdm_hwc_window.c @@ -39,6 +39,8 @@ #include "tdm_private.h" +/* LCOV_EXCL_START */ + #define COUNT_MAX 10 #define HWC_WINDOW_FUNC_ENTRY() \ @@ -86,13 +88,11 @@ tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_get_tbm_buffer_queue) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); if (error) *error = TDM_ERROR_NOT_IMPLEMENTED; return NULL; - /* LCOV_EXCL_STOP */ } queue = func_hwc_window->hwc_window_get_tbm_buffer_queue(private_hwc_window->hwc_window_backend, error); @@ -119,11 +119,9 @@ tdm_hwc_window_set_composition_type(tdm_hwc_window *hwc_window, func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_set_composition_type) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_set_composition_type(private_hwc_window->hwc_window_backend, composition_type); @@ -149,11 +147,9 @@ tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_hwc_region dama func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_set_buffer_damage) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_set_buffer_damage(private_hwc_window->hwc_window_backend, damage); @@ -181,11 +177,9 @@ tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info) func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_set_info) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } if (info->src_config.format) @@ -220,23 +214,19 @@ tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer) _pthread_mutex_lock(&private_display->lock); if ((tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) && buffer) { - /* LCOV_EXCL_START */ char str[TDM_PATH_LEN]; static int i; snprintf(str, TDM_PATH_LEN, "window_%d_%03d", private_output->index, i++); tdm_helper_dump_buffer_str(buffer, tdm_debug_dump_dir, str); - /* LCOV_EXCL_STOP */ } private_module = private_output->private_module; func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_set_buffer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_set_buffer(private_hwc_window->hwc_window_backend, buffer); @@ -260,11 +250,9 @@ tdm_hwc_window_unset_buffer(tdm_hwc_window *hwc_window) func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_unset_buffer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_unset_buffer(private_hwc_window->hwc_window_backend); @@ -289,11 +277,9 @@ tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, if (!is_video) { if (!func_output->output_hwc_create_window) { - /* LCOV_EXCL_START */ if (error) *error = TDM_ERROR_BAD_MODULE; return NULL; - /* LCOV_EXCL_STOP */ } hwc_window_backend = func_output->output_hwc_create_window( @@ -305,11 +291,9 @@ tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, } } else { if (!func_output->output_hwc_create_video_window) { - /* LCOV_EXCL_START */ if (error) *error = TDM_ERROR_NOT_IMPLEMENTED; return NULL; - /* LCOV_EXCL_STOP */ } hwc_window_backend = func_output->output_hwc_create_video_window( @@ -323,13 +307,11 @@ tdm_hwc_window_create_internal(tdm_private_output *private_output, int is_video, private_hwc_window = calloc(1, sizeof(tdm_private_hwc_window)); if (!private_hwc_window) { - /* LCOV_EXCL_START */ TDM_ERR("failed: alloc memory"); func_output->output_hwc_destroy_window(private_output->output_backend, hwc_window_backend); if (error) *error = TDM_ERROR_OUT_OF_MEMORY; return NULL; - /* LCOV_EXCL_STOP */ } LIST_ADD(&private_hwc_window->link, &private_output->hwc_window_list); @@ -384,11 +366,9 @@ tdm_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags) func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_set_flags) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_set_flags(private_hwc_window->hwc_window_backend, flags); @@ -412,11 +392,9 @@ tdm_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_unset_flags) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_unset_flags(private_hwc_window->hwc_window_backend, flags); @@ -461,21 +439,17 @@ tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_get_layer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } layer = func_hwc_window->hwc_window_get_layer(private_hwc_window->hwc_window_backend, &ret); if (!layer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("no assigned layer!!"); return TDM_ERROR_INVALID_PARAMETER; - /* LCOV_EXCL_STOP */ } private_layer = (tdm_private_layer*)layer; @@ -487,36 +461,28 @@ tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler else ret = tdm_layer_unset_buffer_internal(private_layer); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: layer set buffer(window)"); - /* LCOV_EXCL_STOP */ return ret; } ret = func_hwc_window->hwc_window_get_info(private_hwc_window->hwc_window_backend, &window_info); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: commit layer(window)"); - /* LCOV_EXCL_STOP */ return ret; } info_layer = (tdm_info_layer *)&window_info; ret = tdm_layer_set_info_internal(private_layer, info_layer); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: layer set info(window)"); - /* LCOV_EXCL_STOP */ return ret; } hwc_window_commit_handler = calloc(1, sizeof(tdm_private_hwc_window_commit_handler)); if (!hwc_window_commit_handler) { - /* LCOV_EXCL_START */ TDM_ERR("failed: alloc memory"); return TDM_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ } hwc_window_commit_handler->private_hwc_window = private_hwc_window; @@ -525,10 +491,8 @@ tdm_hwc_window_commit(tdm_hwc_window *hwc_window, tdm_hwc_window_commit_handler ret = tdm_layer_commit_internal(private_layer, _tdm_hwc_window_layer_commit_handler, hwc_window_commit_handler); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: commit layer(window)"); free(hwc_window_commit_handler); - /* LCOV_EXCL_STOP */ return ret; } @@ -554,11 +518,9 @@ tdm_hwc_window_video_get_capability(tdm_hwc_window *hwc_window, func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_video_get_capability) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_video_get_capability(private_hwc_window->hwc_window_backend, @@ -587,11 +549,9 @@ tdm_hwc_window_video_get_available_properties(tdm_hwc_window *hwc_window, func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_video_get_available_properties) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_hwc_window->hwc_window_video_get_available_properties(private_hwc_window->hwc_window_backend, @@ -619,11 +579,9 @@ tdm_hwc_window_video_get_property(tdm_hwc_window *hwc_window, func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_video_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_window->hwc_window_video_get_property(private_hwc_window->hwc_window_backend, @@ -649,11 +607,9 @@ tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, func_hwc_window = &private_module->func_hwc_window; if (!func_hwc_window->hwc_window_video_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_window->hwc_window_video_set_property(private_hwc_window->hwc_window_backend, @@ -663,3 +619,4 @@ tdm_hwc_window_video_set_property(tdm_hwc_window *hwc_window, return ret; } +/* LCOV_EXCL_STOP */ \ No newline at end of file diff --git a/src/tdm_macro.h b/src/tdm_macro.h index 00af3ef..a84b82a 100644 --- a/src/tdm_macro.h +++ b/src/tdm_macro.h @@ -103,6 +103,7 @@ extern "C" { #define TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms) ((dpms) & TDM_OUTPUT_DPMS_VSYNC_OFF_MASK) /* strtostr *****************************************************************/ +/* LCOV_EXCL_START */ static inline char* strtostr(char *buf, int len, char *str, char *delim) { @@ -117,6 +118,7 @@ strtostr(char *buf, int len, char *str, char *delim) snprintf(buf, len, "%s", str); return str + len - 1; } +/* LCOV_EXCL_STOP */ /* EXTERN, INTERN, DEPRECATED ***********************************************/ #undef EXTERN diff --git a/src/tdm_output.c b/src/tdm_output.c index 6543b7d..9b9d200 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1563,6 +1563,7 @@ tdm_output_create_capture(tdm_output *output, tdm_error *error) return capture; } +/* LCOV_EXCL_START */ EXTERN tdm_hwc_window * tdm_output_hwc_create_window(tdm_output *output, tdm_error *error) { @@ -1575,11 +1576,9 @@ tdm_output_hwc_create_window(tdm_output *output, tdm_error *error) if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, 0, error); else { - /* LCOV_EXCL_START */ TDM_ERR("output(%p) not support HWC", private_output); if (error) *error = TDM_ERROR_BAD_REQUEST; - /* LCOV_EXCL_STOP */ } _pthread_mutex_unlock(&private_display->lock); @@ -1599,11 +1598,9 @@ tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error) if (private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_HWC) hwc_window = (tdm_hwc_window *)tdm_hwc_window_create_internal(private_output, 1, error); else { - /* LCOV_EXCL_START */ TDM_ERR("output(%p) not support HWC", private_output); if (error) *error = TDM_ERROR_BAD_REQUEST; - /* LCOV_EXCL_STOP */ } _pthread_mutex_unlock(&private_display->lock); @@ -1653,11 +1650,9 @@ tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, func_output = &private_module->func_output; if (!func_output->output_hwc_validate) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } if (num_wnds == 0) { @@ -1670,10 +1665,8 @@ tdm_output_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, composited_wnds_backend = calloc(num_wnds, sizeof(tdm_hwc_window *)); if (!composited_wnds_backend) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); return TDM_ERROR_OUT_OF_MEMORY; - /* LCOV_EXCL_STOP */ } composited_wnds_frontend = (tdm_private_hwc_window **)composited_wnds; @@ -1747,20 +1740,16 @@ tdm_output_hwc_get_changed_composition_types(tdm_output *output, func_output = &private_module->func_output; if (!func_output->output_hwc_get_changed_composition_types) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_output->output_hwc_get_changed_composition_types(private_output->output_backend, num_elements, hwc_window, composition_types); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); return ret; - /* LCOV_EXCL_STOP */ } if (hwc_window == NULL || composition_types == NULL) { @@ -1773,13 +1762,11 @@ tdm_output_hwc_get_changed_composition_types(tdm_output *output, private_hwc_window = _tdm_output_find_private_hwc_window(private_output, hwc_window[i]); if (private_hwc_window == NULL) { - /* LCOV_EXCL_START */ TDM_ERR("failed! This should never happen!"); func_output->output_hwc_destroy_window(private_output->output_backend, hwc_window[i]); *num_elements = 0; _pthread_mutex_unlock(&private_display->lock); return TDM_ERROR_OPERATION_FAILED; - /* LCOV_EXCL_STOP */ } hwc_window[i] = (tdm_hwc_window*)private_hwc_window; @@ -1810,11 +1797,9 @@ tdm_output_hwc_accept_changes(tdm_output *output) func_output = &private_module->func_output; if (!func_output->output_hwc_validate) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_output->output_hwc_accept_changes(private_output->output_backend); @@ -1847,11 +1832,9 @@ tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error) func_output = &private_module->func_output; if (!func_output->output_hwc_get_target_buffer_queue) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return NULL; - /* LCOV_EXCL_STOP */ } queue = func_output->output_hwc_get_target_buffer_queue(private_output->output_backend, error); @@ -1878,24 +1861,20 @@ tdm_output_hwc_set_client_target_buffer(tdm_output *output, tbm_surface_h target } if (tdm_debug_dump & TDM_DUMP_FLAG_WINDOW) { - /* LCOV_EXCL_START */ char str[TDM_PATH_LEN]; static int i; snprintf(str, TDM_PATH_LEN, "target_window_%d_%03d", private_output->index, i++); tdm_helper_dump_buffer_str(target_buffer, tdm_debug_dump_dir, str); - /* LCOV_EXCL_STOP */ } private_module = private_output->private_module; func_output = &private_module->func_output; if (!func_output->output_hwc_set_client_target_buffer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_output->output_hwc_set_client_target_buffer(private_output->output_backend, target_buffer, damage); @@ -1925,11 +1904,9 @@ tdm_output_hwc_unset_client_target_buffer(tdm_output *output) func_output = &private_module->func_output; if (!func_output->output_hwc_unset_client_target_buffer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_output->output_hwc_unset_client_target_buffer(private_output->output_backend); @@ -1979,31 +1956,25 @@ tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_ta func_output = &private_module->func_output; if (!func_output->output_hwc_get_client_target_buffer_layer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } layer = func_output->output_hwc_get_client_target_buffer_layer(private_output->output_backend, &ret); if (!layer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("no assigned layer!!"); return TDM_ERROR_INVALID_PARAMETER; - /* LCOV_EXCL_STOP */ } private_layer = (tdm_private_layer*)layer; if (!func_output->output_hwc_get_client_target_buffer) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_ERR("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } buffer = func_output->output_hwc_get_client_target_buffer(private_output->output_backend, @@ -2013,10 +1984,8 @@ tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_ta else ret = tdm_layer_unset_buffer_internal(private_layer); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: layer set info(window)"); _pthread_mutex_unlock(&private_display->lock); - /* LCOV_EXCL_STOP */ return ret; } @@ -2036,10 +2005,8 @@ tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_ta ret = tdm_layer_set_info_internal(private_layer, &private_output->target_buffer_info); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: layer set info(window)"); _pthread_mutex_unlock(&private_display->lock); - /* LCOV_EXCL_STOP */ return ret; } @@ -2048,11 +2015,9 @@ tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_ta output_hwc_target_buffer_commit_handler = calloc(1, sizeof(tdm_private_output_hwc_target_buffer_commit_handler)); if (!output_hwc_target_buffer_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 */ } output_hwc_target_buffer_commit_handler->private_output = private_output; @@ -2061,11 +2026,9 @@ tdm_output_hwc_commit_client_target_buffer(tdm_output *output, tdm_output_hwc_ta ret = tdm_layer_commit_internal(private_layer, _tdm_output_hwc_layer_commit_handler, output_hwc_target_buffer_commit_handler); if (ret != TDM_ERROR_NONE) { - /* LCOV_EXCL_START */ TDM_ERR("failed: commit layer(target buffer)"); free(output_hwc_target_buffer_commit_handler); _pthread_mutex_unlock(&private_display->lock); - /* LCOV_EXCL_STOP */ return ret; } @@ -2091,11 +2054,9 @@ tdm_output_hwc_get_video_supported_formats(tdm_output *output, const tbm_format func_output = &private_module->func_output; if (!func_output->output_hwc_get_video_supported_formats) { - /* LCOV_EXCL_START */ _pthread_mutex_unlock(&private_display->lock); TDM_WRN("not implemented!!"); return TDM_ERROR_NOT_IMPLEMENTED; - /* LCOV_EXCL_STOP */ } ret = func_output->output_hwc_get_video_supported_formats( @@ -2232,3 +2193,4 @@ tdm_output_choose_commit_per_vblank_mode(tdm_private_output *private_output, int return TDM_ERROR_NONE; } +/* LCOV_EXCL_STOP */ -- 2.7.4 From c5d34acb3cd217e269f9215b2fa64d8a7b4b55d6 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Fri, 6 Apr 2018 16:42:06 +0900 Subject: [PATCH 13/16] buffer: remove unuseful function the behavior of tdm_buffer_remove_release_handler_internal is not clear. even if commit is failed, the buffer release function seems to need to be called. Change-Id: Idbf92ea109272d5556680ed87212095126d8b1cf --- src/tdm_buffer.c | 20 -------------------- src/tdm_capture.c | 6 ------ src/tdm_pp.c | 8 -------- src/tdm_private.h | 2 -- 4 files changed, 36 deletions(-) diff --git a/src/tdm_buffer.c b/src/tdm_buffer.c index 81716b5..97857b4 100644 --- a/src/tdm_buffer.c +++ b/src/tdm_buffer.c @@ -170,26 +170,6 @@ tdm_buffer_remove_release_handler(tbm_surface_h buffer, } } -INTERN void -tdm_buffer_remove_release_handler_internal(tbm_surface_h buffer) -{ - tdm_buffer_info *buf_info; - tdm_buffer_func_info *func_info = NULL, *next = NULL; - - TDM_RETURN_IF_FAIL(buffer != NULL); - - buf_info = tdm_buffer_get_info(buffer); - TDM_RETURN_IF_FAIL(buf_info != NULL); - - LIST_FOR_EACH_ENTRY_SAFE(func_info, next, &buf_info->release_funcs, link) { - - LIST_DEL(&func_info->link); - free(func_info); - - return; - } -} - EXTERN tbm_surface_h tdm_buffer_ref_backend(tbm_surface_h buffer) { diff --git a/src/tdm_capture.c b/src/tdm_capture.c index 4b58fbd..1fd5bb4 100644 --- a/src/tdm_capture.c +++ b/src/tdm_capture.c @@ -663,12 +663,6 @@ tdm_capture_commit(tdm_capture *capture) if (ret != TDM_ERROR_NONE) { /* LCOV_EXCL_START */ - /* Not to call the user release handler when failed. - * Do we have to call this function here really? - * User better use set_done_handler to know when pp is done. Using - * buffer_release_handler is not good. - */ - tdm_buffer_remove_release_handler_internal(b->buffer); _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(b->buffer); diff --git a/src/tdm_pp.c b/src/tdm_pp.c index 1a0e91e..a53531a 100644 --- a/src/tdm_pp.c +++ b/src/tdm_pp.c @@ -573,14 +573,6 @@ tdm_pp_commit(tdm_pp *pp) continue; if (ret != TDM_ERROR_NONE) { - /* Not to call the user release handler when failed. - * Do we have to call this function here really? - * User better use set_done_handler to know when pp is done. Using - * buffer_release_handler is not good. - */ - tdm_buffer_remove_release_handler_internal(b->src); - tdm_buffer_remove_release_handler_internal(b->dst); - _pthread_mutex_unlock(&private_display->lock); tdm_buffer_unref_backend(b->src); tdm_buffer_unref_backend(b->dst); diff --git a/src/tdm_private.h b/src/tdm_private.h index 40f9e79..22c984c 100644 --- a/src/tdm_private.h +++ b/src/tdm_private.h @@ -187,8 +187,6 @@ tdm_capture_destroy_internal(tdm_private_capture *private_capture); /* utility buffer functions for private */ tdm_buffer_info* tdm_buffer_get_info(tbm_surface_h buffer); -void -tdm_buffer_remove_release_handler_internal(tbm_surface_h buffer); /* event functions for private */ tdm_error -- 2.7.4 From 3ad3e82dc0bc043697fc72d34c5cf7d051b69af4 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 9 Apr 2018 20:43:57 +0900 Subject: [PATCH 14/16] common: remove unuseful variable Change-Id: I1f47f58fb65b5b18f08e64b790e11c4c195e1c32 --- src/tdm.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index 15840f4..1a84fc0 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -477,19 +477,17 @@ tdm_display_update_output(tdm_private_module *private_module, return TDM_ERROR_NONE; } -static tdm_output ** +static void _tdm_display_set_main_first(tdm_output **outputs, int index) { tdm_output *output_tmp = NULL; if (index == 0) - return outputs; + return; output_tmp = outputs[0]; outputs[0] = outputs[index]; outputs[index] = output_tmp; - - return outputs; } static tdm_output ** @@ -497,7 +495,6 @@ _tdm_display_get_ordered_outputs(tdm_private_module *private_module, int *count) { tdm_func_display *func_display = &private_module->func_display; tdm_output **outputs = NULL; - tdm_output **new_outputs = NULL; tdm_output *output_dsi = NULL; tdm_output *output_lvds = NULL; tdm_output *output_hdmia = NULL; @@ -580,32 +577,28 @@ _tdm_display_get_ordered_outputs(tdm_private_module *private_module, int *count) if (output_connected_count == 0) { /* hdmi > dsi > lvds > else */ if (output_hdmia != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_hdmia); + _tdm_display_set_main_first(outputs, index_hdmia); else if (output_hdmib != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_hdmib); + _tdm_display_set_main_first(outputs, index_hdmib); else if (output_dsi != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_dsi); + _tdm_display_set_main_first(outputs, index_dsi); else if (output_lvds != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_lvds); - else - new_outputs = outputs; + _tdm_display_set_main_first(outputs, index_lvds); } else { /* (output_connected_count > 1) */ /* dsi > lvds > hdmi > else */ if (output_dsi != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_dsi); + _tdm_display_set_main_first(outputs, index_dsi); else if (output_lvds != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_lvds); + _tdm_display_set_main_first(outputs, index_lvds); else if (output_hdmia != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_hdmia); + _tdm_display_set_main_first(outputs, index_hdmia); else if (output_hdmib != NULL) - new_outputs = _tdm_display_set_main_first(outputs, index_hdmib); - else - new_outputs = outputs; + _tdm_display_set_main_first(outputs, index_hdmib); } - private_module->outputs = new_outputs; + private_module->outputs = outputs; - return new_outputs; + return outputs; failed_get_outputs: free(outputs); -- 2.7.4 From e3bf909bf70dabcee8bb28a68fdb75b1a93fc671 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 9 Apr 2018 20:44:18 +0900 Subject: [PATCH 15/16] common: fix syntax error Change-Id: Ib6c52268e151511ba4aef5f15a84ac2adcba993b --- src/tdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tdm.c b/src/tdm.c index 1a84fc0..08a9136 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -883,7 +883,7 @@ static tdm_error _tdm_display_load_modules(tdm_private_display *private_display) { const char *module_names; - tdm_error ret = 0; + tdm_error ret = TDM_ERROR_NONE; char temp[TDM_PATH_LEN]; char *arg; char *end; -- 2.7.4 From d6ada65f4863702f6d7d5c1080b408e332fb8923 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Mon, 9 Apr 2018 21:15:59 +0900 Subject: [PATCH 16/16] common: remove unuseful condition output_get_capability can't be null at this function. checking null is already done in other function. Change-Id: I737ab197eba4763cc6afbfd65d8b8e8183c4a122 --- src/tdm.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/tdm.c b/src/tdm.c index 08a9136..be3d0bf 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -528,11 +528,6 @@ _tdm_display_get_ordered_outputs(tdm_private_module *private_module, int *count) tdm_caps_output caps; memset(&caps, 0, sizeof(tdm_caps_output)); - if (!func_output->output_get_capability) { - TDM_ERR("no output_get_capability()"); - goto failed_get_outputs; - } - ret = func_output->output_get_capability(outputs[i], &caps); if (ret != TDM_ERROR_NONE) { TDM_ERR("output_get_capability() failed"); -- 2.7.4