From 467676689e95461455f3ea6e2c994617e613f2cc Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 7 Mar 2019 17:19:46 +0900 Subject: [PATCH 01/16] Package version up to 2.8.3 Change-Id: Ia72f18868fb5e6db682597edaa095a3e703fd253 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 7bf0a3e..9a23587 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.2 +Version: 2.8.3 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From b0316bc50edba33498a86f9a6cf4d857ab836bf3 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 21 Mar 2019 13:31:22 +0900 Subject: [PATCH 02/16] tdm_server: fix stack buffer overflow Change-Id: I7b762077a0834a4873adaf894668290285f65f7d Signed-off-by: Junkyeong Kim --- src/tdm_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tdm_server.c b/src/tdm_server.c index 6c4c6ab..cfaf044 100644 --- a/src/tdm_server.c +++ b/src/tdm_server.c @@ -148,8 +148,8 @@ _tdm_server_get_process_name(pid_t pid, char *name, unsigned int size) len = fread(pname, sizeof(char), TDM_NAME_LEN, h); if (len == 0) { - char *p = strncpy(pname, "NO NAME", sizeof(pname) - 1); - len = p - pname; + strncpy(pname, "NO NAME", 7); + len = 8; } pname[len - 1] = '\0'; -- 2.7.4 From 037c71e16d6baa284aaef55a06bd916c5ff8f750 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 1 Apr 2019 18:51:12 +0900 Subject: [PATCH 03/16] Package version up to 2.8.4 Change-Id: I731b9115a083a2c412e3c589deaf0f31d62f9766 Signed-off-by: Junkyeong Kim --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 9a23587..3188c89 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.3 +Version: 2.8.4 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From c912cbe6b33ba30309388719316775e5fc44555a Mon Sep 17 00:00:00 2001 From: Mateusz Moscicki Date: Fri, 19 Apr 2019 13:54:17 +0200 Subject: [PATCH 04/16] tizen: Add additional unit for "unified" user session The unified user session is about moving user session units, managed by systemd --user, to main systemd, where it's managed as part of newly created user@.target. user@.target will contain same units as previously available in user/, with same UID and environment setup. systemd instance is used for unit to be able to specify UID (inherited from user@.target). The rationale behind this work is following: * VD requirement to remove user session support * boot time optimization requirements, due to: + 'systemd --user' taking 1s its own startup that could be used for unit startup + ability to better rearrange units if these managed by one systemd instance Unit installed by this commit will not be used till user login mechanism will be changed in systemd package (via changing pam_systemd to start user@.target, rather than user@.service). Change-Id: I86da33a05560b73c44c39c073f4ac6ca11fd6e86 --- packaging/libtdm.spec | 10 ++++++++++ service/tdm-socket-user@.path | 9 +++++++++ service/tdm-socket-user@.service | 15 +++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 service/tdm-socket-user@.path create mode 100644 service/tdm-socket-user@.service diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 3188c89..cb3c0c8 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -98,6 +98,10 @@ rm -rf %{buildroot} install -m 644 service/tdm-socket-user.service %{buildroot}%{_unitdir_user} install -m 644 service/tdm-socket-user.path %{buildroot}%{_unitdir_user} +%__mkdir_p %{buildroot}%{_unitdir} +install -m 644 service/tdm-socket-user@.service %{buildroot}%{_unitdir} +install -m 644 service/tdm-socket-user@.path %{buildroot}%{_unitdir} + %remove_docs @@ -105,9 +109,13 @@ install -m 644 service/tdm-socket-user.path %{buildroot}%{_unitdir_user} %__mkdir_p %{_unitdir_user}/basic.target.wants ln -sf ../tdm-socket-user.path %{_unitdir_user}/basic.target.wants/ +%__mkdir_p %{_unitdir}/user-basic@.target.wants +ln -sf ../tdm-socket-user@.path %{_unitdir}/user-basic@.target.wants/ + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig rm -f %{_unitdir_user}/basic.target.wants/tdm-socket-user.path +rm -f %{_unitdir}/user-basic@.target.wants/tdm-socket-user@.path %files %manifest %{name}.manifest @@ -119,6 +127,8 @@ rm -f %{_unitdir_user}/basic.target.wants/tdm-socket-user.path %attr(750,root,root) %{_bindir}/tdm-monitor %{_unitdir_user}/tdm-socket-user.path %{_unitdir_user}/tdm-socket-user.service +%{_unitdir}/tdm-socket-user@.path +%{_unitdir}/tdm-socket-user@.service %files devel %manifest %{name}.manifest diff --git a/service/tdm-socket-user@.path b/service/tdm-socket-user@.path new file mode 100644 index 0000000..e71810c --- /dev/null +++ b/service/tdm-socket-user@.path @@ -0,0 +1,9 @@ +[Unit] +PartOf=userlogin@%i.target +DefaultDependencies=no +After=systemd-logind.service +After=systemd-logind.service systemd-logind.service +Description=Wait for tdm-socket + +[Path] +PathExists=/run/tdm-socket diff --git a/service/tdm-socket-user@.service b/service/tdm-socket-user@.service new file mode 100644 index 0000000..4fca44d --- /dev/null +++ b/service/tdm-socket-user@.service @@ -0,0 +1,15 @@ +[Unit] +PartOf=userlogin@%i.target +After=systemd-logind.service +After=display-manager.service systemd-logind.service +Description=Creating a link file for user to access tdm-socket +DefaultDependencies=no +Before=starter@%i.service + +[Service] +User=%i +Environment=DBUS_SESSION_BUS_ADDRESS=kernel:path=/sys/fs/kdbus/%i-user/bus;unix:path=/run/user/%i/bus +Environment=XDG_RUNTIME_DIR=/run/user/%i +SmackProcessLabel=User +Type=oneshot +ExecStart=/usr/bin/sh -c "while [ ! -e /run/tdm-socket ] ; do /usr/bin/sleep .1 ; done ;/usr/bin/ln -s /run/tdm-socket /run/user/%i/" -- 2.7.4 From 85eff7cbb708f7c1fbafac3c2c721a0e08da9e1a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 3 May 2019 08:41:50 +0900 Subject: [PATCH 05/16] Package version up to 2.8.5 Change-Id: Ie60e55a1c1749ef2049ddbb1d1f38bc94d9545e7 --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index cb3c0c8..cfa6ed6 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.4 +Version: 2.8.5 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From ee203debcbb7e7e595c6da2663759a1bb1f429ed Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:04:27 +0900 Subject: [PATCH 06/16] tdm_output: add missing mutex unlock Change-Id: Ia61c524b809cfa45a25f3415af4fea7e036a53ee Signed-off-by: Junkyeong Kim --- src/tdm_output.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tdm_output.c b/src/tdm_output.c index 6516b6c..8354d07 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1427,6 +1427,7 @@ tdm_output_set_voutput_commit(tdm_voutput *voutput) ret = tdm_voutput_set_commit_func(private_voutput, _tdm_voutput_cb_commit); if (ret != TDM_ERROR_NONE) { TDM_ERR("failed: tdm_voutput_set_commit_func"); + _pthread_mutex_unlock(&private_display->lock); return ret; } } -- 2.7.4 From 8beab8406229bf9f2f26954b98031f5537ffbe39 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:21:47 +0900 Subject: [PATCH 07/16] tdm_client: check calloc fail Change-Id: I30ffda55cd4d44d794057321ed79c936d4b186d0 Signed-off-by: Junkyeong Kim --- client/tdm_client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/tdm_client.c b/client/tdm_client.c index 3a2ab48..bde7a1f 100644 --- a/client/tdm_client.c +++ b/client/tdm_client.c @@ -2218,6 +2218,11 @@ tdm_client_voutput_set_available_modes(tdm_client_voutput *voutput, const tdm_cl if (count != 0) { private_voutput->available_modes.modes = calloc(count, sizeof(tdm_client_output_mode)); + if (private_voutput->available_modes.modes == NULL) { + private_voutput->available_modes.count = 0; + pthread_mutex_unlock(&private_client->lock); + return TDM_ERROR_OUT_OF_MEMORY; + } memcpy(private_voutput->available_modes.modes, modes, sizeof(tdm_client_output_mode) * count); } -- 2.7.4 From e315fbafc737fdcb044cba2a7f0c5b7d5a0820ee Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 9 Jul 2019 17:30:54 +0900 Subject: [PATCH 08/16] Package version up to 2.8.6 Change-Id: Icba91a8d99300925c3d6721c5f2fa85d5c0ee855 Signed-off-by: Junkyeong Kim --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index cfa6ed6..3fc5591 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.5 +Version: 2.8.6 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From be738dc070af5710a42b3316f7f5a49fd2ac8d2c Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Wed, 10 Jul 2019 14:57:57 +0900 Subject: [PATCH 09/16] tdm_output: fix log parameter Change-Id: If32820c0679e29f76c6dadc1df57663fc3114d98 Signed-off-by: YoungJun Cho --- src/tdm_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tdm_output.c b/src/tdm_output.c index 8354d07..8272cc3 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -429,7 +429,7 @@ tdm_output_cb_dpms(tdm_output *output_backend, tdm_output_dpms dpms, void *user_ tdm_private_output *private_output = user_data; tdm_error ret; - TDM_INFO("output(%d) %s", private_output->pipe, tdm_status_str(dpms)); + TDM_INFO("output(%d) %s", private_output->pipe, tdm_dpms_str(dpms)); private_output->current_dpms_value = dpms; private_output->waiting_dpms_change = 0; -- 2.7.4 From 691fe1866fab25603336cc11e6bba47c0064ca98 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Fri, 12 Jul 2019 17:47:29 +0900 Subject: [PATCH 10/16] tdm_output: execute mutex unlock before call direct commit handler Change-Id: I14a8899be608cd61ae30603a5ca384d7c8da4393 Signed-off-by: Junkyeong Kim --- src/tdm_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tdm_output.c b/src/tdm_output.c index 8272cc3..285887e 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -1630,8 +1630,11 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl if (TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms_value)) { TDM_WRN("dpms %s. Directly call commit handler instead of commit.", tdm_dpms_str(dpms_value)); - if (func) + if (func) { + _pthread_mutex_unlock(&private_display->lock); func(output, 0, 0, 0, user_data); + _pthread_mutex_lock(&private_display->lock); + } } return ret; -- 2.7.4 From df97f112451306400c71432e1c99b7384fe58b9a Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 15 Jul 2019 16:31:31 +0900 Subject: [PATCH 11/16] Package version up to 2.8.7 Change-Id: Ia464dfe5a2ebe22ed83416a2a3cc1c62a035d94e Signed-off-by: Junkyeong Kim --- packaging/libtdm.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/libtdm.spec b/packaging/libtdm.spec index 3fc5591..3a9b783 100644 --- a/packaging/libtdm.spec +++ b/packaging/libtdm.spec @@ -2,7 +2,7 @@ %define HALTESTS_GCOV 0 Name: libtdm -Version: 2.8.6 +Version: 2.8.7 Release: 0 Summary: User Library of Tizen Display Manager Group: Development/Libraries -- 2.7.4 From 7d4b4af6e3fa30d838b15fb031e2337842823d71 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 18 Jul 2019 20:42:22 +0900 Subject: [PATCH 12/16] hwc: referencing target buffer while showing the target buffer, increase ref count to prevent buffer destroy. Change-Id: I2aa715d1649e16fa91b38767411349e59b8c3d6f Signed-off-by: Junkyeong Kim --- src/tdm.c | 2 ++ src/tdm_hwc.c | 14 ++++++++++++++ src/tdm_private_types.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/tdm.c b/src/tdm.c index 81e653a..f20bfa4 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -335,6 +335,8 @@ tdm_display_destroy_private_output(tdm_private_output *private_output) private_hwc = private_output->private_hwc; LIST_FOR_EACH_ENTRY_SAFE(hw, hww, &private_hwc->hwc_window_list, link) tdm_hwc_window_destroy_internal(hw); + if (private_hwc->display_target_buffer) + tbm_surface_internal_unref(private_hwc->display_target_buffer); free(private_hwc); } else { LIST_FOR_EACH_ENTRY_SAFE(l, ll, &private_output->layer_list, link) diff --git a/src/tdm_hwc.c b/src/tdm_hwc.c index 0589bc1..65f232c 100644 --- a/src/tdm_hwc.c +++ b/src/tdm_hwc.c @@ -357,6 +357,20 @@ tdm_hwc_set_client_target_buffer(tdm_hwc *hwc, tbm_surface_h target_buffer, tdm_ ret = func_hwc->hwc_set_client_target_buffer(private_hwc->hwc_backend, target_buffer, damage); + if (private_hwc->display_target_buffer) { + if (private_hwc->display_target_buffer != target_buffer) { + tbm_surface_internal_unref(private_hwc->display_target_buffer); + private_hwc->display_target_buffer = target_buffer; + if (target_buffer) + tbm_surface_internal_ref(private_hwc->display_target_buffer); + } + } else { + if (target_buffer) { + private_hwc->display_target_buffer = target_buffer; + tbm_surface_internal_ref(private_hwc->display_target_buffer); + } + } + _pthread_mutex_unlock(&private_display->lock); return ret; diff --git a/src/tdm_private_types.h b/src/tdm_private_types.h index 80d867f..dfea22a 100644 --- a/src/tdm_private_types.h +++ b/src/tdm_private_types.h @@ -327,6 +327,8 @@ struct _tdm_private_hwc { int regist_commit_cb; tdm_hwc *hwc_backend; + + tbm_surface_h display_target_buffer; }; struct _tdm_private_hwc_window { -- 2.7.4 From 6da3d27cabac23e7e1745374646fb88b44d4ec7b Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 18 Jul 2019 21:51:43 +0900 Subject: [PATCH 13/16] haltest: support hwc mode skip tdm_layer api and output_commit api test if hwc enabled. do not show the test result to screen if hwc enabled. Change-Id: I80bee46fa75f16bc34cdb00e3f6c7129295bfd95 Signed-off-by: Junkyeong Kim --- haltests/src/tc_tdm.h | 4 +- haltests/src/tc_tdm_backend_capture.cpp | 120 ++++++++++++------ haltests/src/tc_tdm_backend_display.cpp | 114 ++++++++++++++--- haltests/src/tc_tdm_backend_pp.cpp | 73 ++++++++++- haltests/src/tc_tdm_helper.cpp | 3 + haltests/src/tc_tdm_hwc.cpp | 22 ++-- haltests/src/tc_tdm_output.cpp | 214 ++++++++++++++++++++++---------- 7 files changed, 415 insertions(+), 135 deletions(-) diff --git a/haltests/src/tc_tdm.h b/haltests/src/tc_tdm.h index 853f45a..e118e77 100644 --- a/haltests/src/tc_tdm.h +++ b/haltests/src/tc_tdm.h @@ -49,13 +49,13 @@ extern bool enable_porting_debug; #define TDM_UT_CHECK_FLAG(FLAG) \ do {\ - if(!(FLAG)) \ + if (!(FLAG)) \ TDM_UT_WRN("[ ] not supported");\ } while(0) #define TDM_UT_SKIP_FLAG(FLAG) \ do {\ - if(!(FLAG)) {\ + if (!(FLAG)) {\ TDM_UT_WRN("[ SKIPPED ] not supported");\ return;\ }\ diff --git a/haltests/src/tc_tdm_backend_capture.cpp b/haltests/src/tc_tdm_backend_capture.cpp index 010153f..006430e 100644 --- a/haltests/src/tc_tdm_backend_capture.cpp +++ b/haltests/src/tc_tdm_backend_capture.cpp @@ -259,6 +259,9 @@ bool TDMBackendCapture::TestPrepare(int output_idx, int w, int h, tbm_format fmt flags |= TBM_BO_SCANOUT; } + if (tc_tdm_output_is_hwc_enable(outputs[output_idx])) + flags |= TBM_BO_SCANOUT; + TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_buffer_create(w, h, fmt, flags, false, 3, buffers) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_capture_fill_info(outputs[output_idx], buffers[0], t, c, frequency, stretch, &info) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tdm_capture_set_info(capture, &info) == TDM_ERROR_NONE); @@ -573,7 +576,10 @@ TEST_P(TDMBackendCapture, CaptureAttach) continue; for (int f = 0; f < format_count; f++) { - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else + FindLayer(o, formats[f], &dst_pos); ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f], TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true); @@ -666,7 +672,10 @@ TEST_P(TDMBackendCapture, CaptureDestroyWithoutCommit) ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else + FindLayer(o, formats[f], &dst_pos); ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f], TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true); @@ -697,7 +706,10 @@ TEST_P(TDMBackendCapture, CaptureDestroyBeforeDone) ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else + FindLayer(o, formats[f], &dst_pos); ASSERT_EQ(TestPrepare(o, TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f], TDM_TRANSFORM_NORMAL, TDM_CAPTURE_TYPE_ONESHOT, -1, false), true); @@ -742,11 +754,15 @@ TEST_P(TDMBackendCapture, CaptureOneshotLetterboxSize) TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else { + FindLayer(o, formats[f], &dst_pos); - if (!dst_layer) { - TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); - continue; + if (!dst_layer) { + TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); + continue; + } } ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f], @@ -768,14 +784,17 @@ retry: snprintf(temp, sizeof temp, "f%d_b%d", f, b); DumpBuffer(b, temp); #endif - ShowBuffer(b, &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_WRN("hwc_enable, not support showing buffer"); + else + ShowBuffer(b, &dst_pos); } TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)", FOURCC_STR(formats[f]), pipe, dst_layer_index); - - HideLayer(); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + HideLayer(); TestDone(); } @@ -808,11 +827,15 @@ TEST_P(TDMBackendCapture, CaptureOneshotFullSize) TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else { + FindLayer(o, formats[f], &dst_pos); - if (!dst_layer) { - TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); - continue; + if (!dst_layer) { + TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); + continue; + } } ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f], @@ -834,14 +857,17 @@ retry: snprintf(temp, sizeof temp, "f%d_b%d", f, b); DumpBuffer(b, temp); #endif - ShowBuffer(b, &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_WRN("hwc_enable, not support showing buffer"); + else + ShowBuffer(b, &dst_pos); } TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as full size and show? (output: %d, layer: %d)", FOURCC_STR(formats[f]), pipe, dst_layer_index); - - HideLayer(); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + HideLayer(); TestDone(); } @@ -874,11 +900,15 @@ TEST_P(TDMBackendCapture, CaptureOneshotAttachFewTimesInOneCommit) TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else { + FindLayer(o, formats[f], &dst_pos); - if (!dst_layer) { - TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); - continue; + if (!dst_layer) { + TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); + continue; + } } ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f], @@ -902,14 +932,17 @@ retry: snprintf(temp, sizeof temp, "f%d_b%d", f, b); DumpBuffer(b, temp); #endif - ShowBuffer(b, &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_WRN("hwc_enable, not support showing buffer"); + else + ShowBuffer(b, &dst_pos); } TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)", FOURCC_STR(formats[f]), pipe, dst_layer_index); - - HideLayer(); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + HideLayer(); TestDone(); } @@ -940,7 +973,12 @@ _tc_tdm_capture_stream_done_cb(tdm_capture *capture, tbm_surface_h buffer, void DumpBuffer(b, temp); #endif tdm_buffer_add_release_handler(buffer, _tc_tdm_backend_capture_buffer_release_cb, (void*)backend_capture); - backend_capture->ShowBuffer(b, &backend_capture->dst_pos); + if (tc_tdm_output_is_hwc_enable(backend_capture->output)) { + TDM_UT_WRN("hwc_enable, not support showing buffer"); + _tc_tdm_backend_capture_buffer_release_cb(buffer, user_data); + } + else + backend_capture->ShowBuffer(b, &backend_capture->dst_pos); break; } } @@ -974,11 +1012,15 @@ TEST_P(TDMBackendCapture, CaptureStreamLetterboxSize) TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else { + FindLayer(o, formats[f], &dst_pos); - if (!dst_layer) { - TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); - continue; + if (!dst_layer) { + TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); + continue; + } } ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f], @@ -1002,8 +1044,8 @@ retry: TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as letterbox size and show? (output: %d, layer: %d)", FOURCC_STR(formats[f]), pipe, dst_layer_index); - - HideLayer(); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + HideLayer(); TestDone(); } @@ -1034,11 +1076,15 @@ TEST_P(TDMBackendCapture, CaptureStreamFullSize) TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); - FindLayer(o, formats[f], &dst_pos); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + dst_layer = NULL; + else { + FindLayer(o, formats[f], &dst_pos); - if (!dst_layer) { - TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); - continue; + if (!dst_layer) { + TDM_UT_INFO("no proper layer for %c%c%c%c", FOURCC_STR(formats[f])); + continue; + } } ASSERT_EQ(TestPrepare(o, half_size, half_size, formats[f], @@ -1062,8 +1108,8 @@ retry: TDM_UT_ASK_YNR("* Successed to capture a output to a '%c%c%c%c' buffer as full size and show? (output: %d, layer: %d)", FOURCC_STR(formats[f]), pipe, dst_layer_index); - - HideLayer(); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + HideLayer(); TestDone(); } diff --git a/haltests/src/tc_tdm_backend_display.cpp b/haltests/src/tc_tdm_backend_display.cpp index 7fd8464..b79cbd8 100644 --- a/haltests/src/tc_tdm_backend_display.cpp +++ b/haltests/src/tc_tdm_backend_display.cpp @@ -167,6 +167,9 @@ TEST_P(TDMBackendBasic, VerifyLayerObject) tdm_output *output = tdm_display_get_output(dpy, o, &ret); ASSERT_EQ(ret, TDM_ERROR_NONE); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + int layer_count = 0; ASSERT_EQ(tdm_output_get_layer_count(output, &layer_count), TDM_ERROR_NONE); TDM_UT_ASSERT_TRUE(layer_count > 0, @@ -220,6 +223,9 @@ TEST_P(TDMBackendBasic, VerifyLayerGetProperty) tdm_output *output = tdm_display_get_output(dpy, o, &ret); ASSERT_EQ(ret, TDM_ERROR_NONE); + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + int layer_count = 0; ASSERT_EQ(tdm_output_get_layer_count(output, &layer_count), TDM_ERROR_NONE); @@ -324,6 +330,9 @@ TEST_P(TDMBackendBasic, VerifyPrimaryLayerShowOneFrame) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); @@ -354,6 +363,9 @@ TEST_P(TDMBackendBasic, VerifyPrimaryLayerShowManyFrames) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); @@ -400,6 +412,9 @@ TEST_P(TDMBackendBasic, VerifyPrimaryLayerShowOneFrameWithCommitHandler) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); @@ -433,6 +448,9 @@ TEST_P(TDMBackendBasic, VerifyOverlayLayersShowOneFrame) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); @@ -480,6 +498,9 @@ TEST_P(TDMBackendBasic, VerifyOverlayLayersShowManyFrames) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); @@ -554,14 +575,16 @@ TEST_P(TDMBackendBasic, VerifyOutputWaitVblank) ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); - layer = tc_tdm_output_get_primary_layer(outputs[o]); - ASSERT_NE(layer, NULL); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + layer = tc_tdm_output_get_primary_layer(outputs[o]); + ASSERT_NE(layer, NULL); - ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); - ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); - DestroyBuffers(); + ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); + ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); + DestroyBuffers(); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + } /* start from 1 */ for (int t = 1; t < 10; t++) { @@ -604,14 +627,16 @@ TEST_P(TDMBackendBasic, VerifyOutputWaitVblankInterval) ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); - layer = tc_tdm_output_get_primary_layer(outputs[o]); - ASSERT_NE(layer, NULL); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + layer = tc_tdm_output_get_primary_layer(outputs[o]); + ASSERT_NE(layer, NULL); - ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); - ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); - DestroyBuffers(); + ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); + ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); + DestroyBuffers(); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + } /* start from 1 */ for (int t = 1; t < 10; t++) { @@ -651,14 +676,16 @@ TEST_P(TDMBackendBasic, VerifyOutputWaitVblankFewTimesInOneVblank) ASSERT_EQ(tc_tdm_output_mode_setting(outputs[o]), true); ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); - layer = tc_tdm_output_get_primary_layer(outputs[o]); - ASSERT_NE(layer, NULL); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + layer = tc_tdm_output_get_primary_layer(outputs[o]); + ASSERT_NE(layer, NULL); - ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); - ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); - DestroyBuffers(); + ASSERT_EQ(tc_tdm_layer_prepare_buffer(layer, buffers, 1, true), true); + ASSERT_EQ(tc_tdm_layer_set_buffer(layer, buffers[0]), true); + DestroyBuffers(); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + } /* start from 1 */ for (int t = 1; t < 10; t++) { @@ -845,6 +872,9 @@ TEST_P(TDMBackendDisplay, VerifyPirmaryLayerFormat) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + layer = tc_tdm_output_get_primary_layer(outputs[o]); ASSERT_NE(layer, NULL); @@ -888,6 +918,13 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerFormat) { ASSERT_EQ(tc_tdm_output_prepare_all_output(dpy, outputs, output_count, false), true); + if (output_count > 0) { + if (tc_tdm_output_is_hwc_enable(outputs[0])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[0]), true); + TDM_UT_SKIP_FLAG(0); + } + } + for (int l = 0; l < layer_count; l++) { tdm_error ret; tdm_output *output; @@ -958,6 +995,13 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerSize) { ASSERT_EQ(tc_tdm_output_prepare_all_output(dpy, outputs, output_count, false), true); + if (output_count > 0) { + if (tc_tdm_output_is_hwc_enable(outputs[0])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[0]), true); + TDM_UT_SKIP_FLAG(0); + } + } + for (int l = 0; l < layer_count; l++) { tdm_error ret; tdm_output *output; @@ -1033,6 +1077,13 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerScale) { ASSERT_EQ(tc_tdm_output_prepare_all_output(dpy, outputs, output_count, false), true); + if (output_count > 0) { + if (tc_tdm_output_is_hwc_enable(outputs[0])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[0]), true); + TDM_UT_SKIP_FLAG(0); + } + } + for (int l = 0; l < layer_count; l++) { tdm_error ret; tdm_output *output; @@ -1122,6 +1173,13 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerMovePosition) { ASSERT_EQ(tc_tdm_output_prepare_all_output(dpy, outputs, output_count, false), true); + if (output_count > 0) { + if (tc_tdm_output_is_hwc_enable(outputs[0])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[0]), true); + TDM_UT_SKIP_FLAG(0); + } + } + for (int l = 0; l < layer_count; l++) { tdm_error ret; tdm_output *output; @@ -1210,6 +1268,13 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerCrop) { ASSERT_EQ(tc_tdm_output_prepare_all_output(dpy, outputs, output_count, false), true); + if (output_count > 0) { + if (tc_tdm_output_is_hwc_enable(outputs[0])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[0]), true); + TDM_UT_SKIP_FLAG(0); + } + } + for (int l = 0; l < layer_count; l++) { tdm_error ret; tdm_output *output; @@ -1355,6 +1420,9 @@ TEST_P(TDMBackendDisplay, DISABLED_VerifyOutputSetDpmsToOffAfterUnsetWithoutComm if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); tdm_layer *layer = tc_tdm_output_get_primary_layer(outputs[o]); @@ -1375,6 +1443,11 @@ TEST_P(TDMBackendDisplay, DISABLED_VerifyOutputSetDpmsToOffAfterUnsetWithCommit) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); + if (tc_tdm_output_is_hwc_enable(outputs[o])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[o]), true); + TDM_UT_SKIP_FLAG(0); + } + tdm_layer *layer = tc_tdm_output_get_primary_layer(outputs[o]); ASSERT_NE(layer, NULL); @@ -1397,6 +1470,11 @@ TEST_P(TDMBackendDisplay, VerifyLayerGetInfo) if (!tc_tdm_output_is_connected(outputs[o])) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) { + ASSERT_EQ(tc_tdm_output_unset(dpy, outputs[o]), true); + TDM_UT_SKIP_FLAG(0); + } + tbm_surface_h displaying_buffer; tdm_error ret; tdm_info_layer info, temp; diff --git a/haltests/src/tc_tdm_backend_pp.cpp b/haltests/src/tc_tdm_backend_pp.cpp index 424b36c..f739d96 100644 --- a/haltests/src/tc_tdm_backend_pp.cpp +++ b/haltests/src/tc_tdm_backend_pp.cpp @@ -56,6 +56,7 @@ public: tdm_layer *dst_layer; const tbm_format *dst_formats; + tbm_format *pp_formats; int dst_format_count; int dst_zpos; int dst_layer_index; @@ -96,6 +97,7 @@ TDMBackendPP::TDMBackendPP() dst_format_count = 0; dst_zpos = 0; dst_layer_index = 0; + pp_formats = NULL; } void TDMBackendPP::SetUp(void) @@ -136,6 +138,7 @@ void TDMBackendPP::TearDown(void) tdm_pp_destroy(pp); DestroyBuffers(); + ASSERT_EQ(tc_tdm_output_unset(dpy, output), true); TDMBackendDisplay::TearDown(); } @@ -174,6 +177,9 @@ bool TDMBackendPP::PrepareBuffers(int sw, int sh, tbm_format sf, int dw, int dh, dst_flags |= TBM_BO_SCANOUT; } + if (tc_tdm_output_is_hwc_enable(output)) + dst_flags |= TBM_BO_SCANOUT; + TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_buffer_create(sw, sh, sf, src_flags, true, 3, srcbuf) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_buffer_create(dw, dh, df, dst_flags, false, 3, dstbuf) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_pp_fill_info(srcbuf[0], dstbuf[0], t, &info) == true); @@ -187,6 +193,19 @@ bool TDMBackendPP::FindLayerUnderPrimary(void) tdm_error ret; int count; int primary_zpos, zpos; + + if (tc_tdm_output_is_hwc_enable(output)) { + pp_formats = (tbm_format *)calloc(1, sizeof(tbm_format) * 2); + pp_formats[0] = TBM_FORMAT_NV12; + pp_formats[1] = TBM_FORMAT_YUV420; + dst_formats = pp_formats; + dst_format_count = 2; + TDM_UT_RETURN_FALSE_IF_FAIL(dst_formats != NULL); + TDM_UT_RETURN_FALSE_IF_FAIL(dst_format_count > 0); + dst_layer = NULL; + return true; + } + tdm_layer *primary = tc_tdm_output_get_primary_layer(output); TDM_UT_RETURN_FALSE_IF_FAIL(primary != NULL); TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_layer_count(output, &count) == TDM_ERROR_NONE); @@ -217,6 +236,19 @@ bool TDMBackendPP::FindLayerOverPrimary(void) tdm_error ret; int count; int primary_zpos, zpos; + + if (tc_tdm_output_is_hwc_enable(output)) { + pp_formats = (tbm_format *)calloc(1, sizeof(tbm_format) * 2); + pp_formats[0] = TBM_FORMAT_ARGB8888; + pp_formats[1] = TBM_FORMAT_XRGB8888; + dst_formats = formats; + dst_format_count = 2; + TDM_UT_RETURN_FALSE_IF_FAIL(dst_formats != NULL); + TDM_UT_RETURN_FALSE_IF_FAIL(dst_format_count > 0); + dst_layer = NULL; + return true; + } + tdm_layer *primary = tc_tdm_output_get_primary_layer(output); TDM_UT_RETURN_FALSE_IF_FAIL(primary != NULL); TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_layer_count(output, &count) == TDM_ERROR_NONE); @@ -254,6 +286,9 @@ _tc_tdm_backend_pp_output_commit_cb(tdm_output *output, unsigned int sequence, void TDMBackendPP::ShowBuffer(int b) { ASSERT_NE(output, NULL); + if (tc_tdm_output_is_hwc_enable(output)) + TDM_UT_SKIP_FLAG(0); + ASSERT_NE(dst_layer, NULL); bool done = false; @@ -268,6 +303,9 @@ void TDMBackendPP::ShowBuffer(int b) void TDMBackendPP::HideLayer(void) { ASSERT_NE(output, NULL); + if (tc_tdm_output_is_hwc_enable(output)) + TDM_UT_SKIP_FLAG(0); + ASSERT_NE(dst_layer, NULL); tdm_layer_unset_buffer(dst_layer); @@ -525,7 +563,8 @@ TEST_P(TDMBackendPP, PPConvertUnderlay) FindLayerUnderPrimary(); - ASSERT_NE(dst_layer, NULL); + if (!tc_tdm_output_is_hwc_enable(output)) + ASSERT_NE(dst_layer, NULL); for (int f = 0; f < dst_format_count; f++) { bool done; @@ -564,6 +603,10 @@ retry: DestroyPP(); DestroyBuffers(); } + if (tc_tdm_output_is_hwc_enable(output) && pp_formats) { + free(pp_formats); + pp_formats = NULL; + } } TEST_P(TDMBackendPP, PPConvertOverlay) @@ -572,7 +615,8 @@ TEST_P(TDMBackendPP, PPConvertOverlay) FindLayerOverPrimary(); - TDM_UT_SKIP_FLAG(dst_layer != NULL); + if (!tc_tdm_output_is_hwc_enable(output)) + TDM_UT_SKIP_FLAG(dst_layer != NULL); for (int f = 0; f < dst_format_count; f++) { bool done; @@ -611,6 +655,10 @@ retry: DestroyPP(); DestroyBuffers(); } + if (tc_tdm_output_is_hwc_enable(output) && pp_formats) { + free(pp_formats); + pp_formats = NULL; + } } TEST_P(TDMBackendPP, PPConvertScale) @@ -619,7 +667,8 @@ TEST_P(TDMBackendPP, PPConvertScale) FindLayerUnderPrimary(); - ASSERT_NE(dst_layer, NULL); + if (!tc_tdm_output_is_hwc_enable(output)) + ASSERT_NE(dst_layer, NULL); for (int f = 0; f < dst_format_count; f++) { bool done; @@ -658,6 +707,10 @@ retry: DestroyPP(); DestroyBuffers(); } + if (tc_tdm_output_is_hwc_enable(output) && pp_formats) { + free(pp_formats); + pp_formats = NULL; + } } TEST_P(TDMBackendPP, PPConvertTransform) @@ -666,7 +719,8 @@ TEST_P(TDMBackendPP, PPConvertTransform) FindLayerUnderPrimary(); - ASSERT_NE(dst_layer, NULL); + if (!tc_tdm_output_is_hwc_enable(output)) + ASSERT_NE(dst_layer, NULL); for (int f = 0; f < dst_format_count; f++) { for (int t = (int)TDM_TRANSFORM_90; t <= (int)TDM_TRANSFORM_FLIPPED_270; t++) { @@ -707,6 +761,10 @@ retry: DestroyBuffers(); } } + if (tc_tdm_output_is_hwc_enable(output) && pp_formats) { + free(pp_formats); + pp_formats = NULL; + } } TEST_P(TDMBackendPP, PPConvertCSC) @@ -716,7 +774,8 @@ TEST_P(TDMBackendPP, PPConvertCSC) FindLayerUnderPrimary(); - ASSERT_NE(dst_layer, NULL); + if (!tc_tdm_output_is_hwc_enable(output)) + ASSERT_NE(dst_layer, NULL); for (int df = 0; df < dst_format_count; df++) { for (int sf = 0; sf < format_count; sf++) { @@ -758,6 +817,10 @@ retry: DestroyBuffers(); } } + if (tc_tdm_output_is_hwc_enable(output) && pp_formats) { + free(pp_formats); + pp_formats = NULL; + } } diff --git a/haltests/src/tc_tdm_helper.cpp b/haltests/src/tc_tdm_helper.cpp index 4509cd0..6ac40da 100644 --- a/haltests/src/tc_tdm_helper.cpp +++ b/haltests/src/tc_tdm_helper.cpp @@ -415,6 +415,9 @@ TEST_P(TDMHelper, HelperCaptureOutput) if (!tc_tdm_output_is_connected(output)) continue; + if (tc_tdm_output_is_hwc_enable(outputs[o])) + TDM_UT_SKIP_FLAG(0); + ASSERT_EQ(tc_tdm_output_prepare(dpy, output, true), true); dump = tbm_surface_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, TBM_FORMAT_ARGB8888); diff --git a/haltests/src/tc_tdm_hwc.cpp b/haltests/src/tc_tdm_hwc.cpp index 541414f..b3618e9 100644 --- a/haltests/src/tc_tdm_hwc.cpp +++ b/haltests/src/tc_tdm_hwc.cpp @@ -209,7 +209,7 @@ TEST_P(TDMHwc, GetClientTargetBufferQueueFailNullObject) } } -TEST_P(TDMHwc, GetClientTargetBufferQueueFainNoHwc) +TEST_P(TDMHwc, GetClientTargetBufferQueueFailNoHwc) { TDM_UT_SKIP_FLAG(has_outputs); @@ -221,8 +221,8 @@ TEST_P(TDMHwc, GetClientTargetBufferQueueFainNoHwc) hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); - ASSERT_EQ(TDM_ERROR_NONE, error); - ASSERT_NE(NULL, queue); + ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(NULL, queue); } else { queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); ASSERT_NE(TDM_ERROR_NONE, error); @@ -240,6 +240,7 @@ TEST_P(TDMHwc, GetClientTargetBufferQueueSuccessful) tbm_surface_queue_h queue = NULL; for (int o = 0; o < output_count; o++) { + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error); @@ -291,9 +292,11 @@ TEST_P(TDMHwc, SetClientTargetBufferSuccessfulSetBuff) tbm_surface_h target_buff = NULL; for (int o = 0; o < output_count; o++) { + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE); + ASSERT_NE(mode, NULL); target_buff = tbm_surface_internal_create_with_flags(mode->hdisplay, mode->vdisplay, TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT); ASSERT_NE(NULL, target_buff); @@ -315,13 +318,12 @@ TEST_P(TDMHwc, SetClientTargetBufferSuccessfulResetBuff) tdm_hwc *hwc = NULL; tdm_error error = TDM_ERROR_NONE; tdm_region damage = {.num_rects = 0, .rects = NULL}; - tbm_surface_h target_buff = NULL; for (int o = 0; o < output_count; o++) { + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { error = tdm_hwc_set_client_target_buffer(hwc, NULL, damage); - tbm_surface_internal_destroy(target_buff); ASSERT_EQ(TDM_ERROR_NONE, error); } else { error = tdm_hwc_set_client_target_buffer(hwc, NULL, damage); @@ -396,7 +398,7 @@ TEST_P(TDMHwc, AcceptChangesFailNoHwc) hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { error = tdm_hwc_accept_validation(hwc); - ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(TDM_ERROR_NONE, error); } else { error = tdm_hwc_accept_validation(hwc); ASSERT_NE(TDM_ERROR_NONE, error); @@ -417,6 +419,7 @@ TEST_P(TDMHwc, AcceptChangesSuccessful) uint32_t get_num = 0; for (int o = 0; o < output_count; o++) { + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { for (int w = 0; w < HWC_WIN_NUM; w++) { @@ -433,11 +436,12 @@ TEST_P(TDMHwc, AcceptChangesSuccessful) changed_hwc_window = (tdm_hwc_window **)calloc(num_types, sizeof(tdm_hwc_window *)); composition_types = (tdm_hwc_window_composition *)calloc(num_types, sizeof(tdm_hwc_window_composition)); + get_num = num_types; error = tdm_hwc_get_changed_composition_types(hwc, &get_num, changed_hwc_window, composition_types); ASSERT_EQ(TDM_ERROR_NONE, error); ASSERT_EQ(get_num, num_types); - error = tdm_hwc_accept_validation(hwc); + error = tdm_hwc_accept_validation(hwc); ASSERT_EQ(TDM_ERROR_NONE, error); free(composition_types); @@ -474,6 +478,7 @@ TEST_P(TDMHwc, CommitSuccessful) uint32_t get_num = 0; for (int o = 0; o < output_count; o++) { + ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); hwc = tdm_output_get_hwc(outputs[o], &error); if (hwc) { for (int w = 0; w < HWC_WIN_NUM; w++) { @@ -490,6 +495,7 @@ TEST_P(TDMHwc, CommitSuccessful) changed_hwc_window = (tdm_hwc_window **)calloc(num_types, sizeof(tdm_hwc_window *)); composition_types = (tdm_hwc_window_composition *)calloc(num_types, sizeof(tdm_hwc_window_composition)); + get_num = num_types; error = tdm_hwc_get_changed_composition_types(hwc, &get_num, changed_hwc_window, composition_types); ASSERT_EQ(TDM_ERROR_NONE, error); ASSERT_EQ(get_num, num_types); @@ -502,7 +508,7 @@ TEST_P(TDMHwc, CommitSuccessful) } error = tdm_hwc_commit(hwc, 0, _tc_tdm_hwc_commit_cb, NULL); - ASSERT_NE(TDM_ERROR_NONE, error); + ASSERT_EQ(TDM_ERROR_NONE, error); for (int w = 0; w < HWC_WIN_NUM; w++) tdm_hwc_window_destroy(hwc_wnds[w]); diff --git a/haltests/src/tc_tdm_output.cpp b/haltests/src/tc_tdm_output.cpp index 15224f0..75aefe4 100644 --- a/haltests/src/tc_tdm_output.cpp +++ b/haltests/src/tc_tdm_output.cpp @@ -181,6 +181,23 @@ _tc_tdm_output_done_cb(tdm_output *output, unsigned int sequence, } bool +tc_tdm_output_prepare_hwc_buffer(tdm_output *output, tbm_surface_h *buffers, int buffer_count, bool fill) +{ + int w, h; + const tdm_output_mode *mode = NULL; + + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_mode(output, &mode) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(mode != NULL); + + w = mode->hdisplay; + h = mode->vdisplay; + + TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_buffer_create(w, h, TBM_FORMAT_ARGB8888, TBM_BO_SCANOUT, fill, buffer_count, buffers) == true); + + return true; +} + +bool tc_tdm_output_prepare(tdm_display *dpy, tdm_output *output, bool fill) { tbm_surface_h buffer = NULL; @@ -189,27 +206,41 @@ tc_tdm_output_prepare(tdm_display *dpy, tdm_output *output, bool fill) tdm_layer *layer; bool done = false; tdm_output_conn_status status; + tdm_region fb_damage; + tdm_hwc *thwc = NULL; + uint32_t num = 0; TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_output_is_connected(output) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_output_mode_setting(output) == true); TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON) == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_primary_index(output, &primary_index) == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(primary_index >= 0); + if (tc_tdm_output_is_hwc_enable(output)) { + TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_output_prepare_hwc_buffer(output, &buffer, 1, fill) == true); + thwc = tdm_output_get_hwc(output, &ret); + TDM_UT_GOTO_IF_FAIL(thwc != NULL, failed); - layer = tdm_output_get_layer(output, primary_index, &ret); - TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(layer != NULL); + TDM_UT_GOTO_IF_FAIL(tdm_hwc_set_client_target_buffer(thwc, buffer, fb_damage) == TDM_ERROR_NONE, failed); + TDM_UT_GOTO_IF_FAIL(tdm_hwc_validate(thwc, NULL, 0, &num) == TDM_ERROR_NONE, failed); + TDM_UT_GOTO_IF_FAIL(tdm_hwc_accept_validation(thwc) == TDM_ERROR_NONE, failed); + TDM_UT_GOTO_IF_FAIL(tdm_hwc_commit(thwc, 0, NULL, NULL) == TDM_ERROR_NONE, failed); + } else { + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_primary_index(output, &primary_index) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(primary_index >= 0); + + layer = tdm_output_get_layer(output, primary_index, &ret); + TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(layer != NULL); - TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_layer_prepare_buffer(layer, &buffer, 1, fill) == true); - TDM_UT_RETURN_FALSE_IF_FAIL(buffer != NULL); + TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_layer_prepare_buffer(layer, &buffer, 1, fill) == true); + TDM_UT_RETURN_FALSE_IF_FAIL(buffer != NULL); - TDM_UT_GOTO_IF_FAIL(tc_tdm_layer_set_buffer(layer, buffer) == true, failed); + TDM_UT_GOTO_IF_FAIL(tc_tdm_layer_set_buffer(layer, buffer) == true, failed); - if (tdm_helper_output_commit_per_vblank_enabled(output)) - TDM_UT_GOTO_IF_FAIL(tdm_layer_commit(layer, NULL, NULL) == TDM_ERROR_NONE, failed); - else - TDM_UT_GOTO_IF_FAIL(tdm_output_commit(output, 0, NULL, NULL) == TDM_ERROR_NONE, failed); + if (tdm_helper_output_commit_per_vblank_enabled(output)) + TDM_UT_GOTO_IF_FAIL(tdm_layer_commit(layer, NULL, NULL) == TDM_ERROR_NONE, failed); + else + TDM_UT_GOTO_IF_FAIL(tdm_output_commit(output, 0, NULL, NULL) == TDM_ERROR_NONE, failed); + } TDM_UT_GOTO_IF_FAIL(tdm_output_get_conn_status(output, &status) == TDM_ERROR_NONE, failed); TDM_UT_GOTO_IF_FAIL(status == TDM_OUTPUT_CONN_STATUS_MODE_SETTED, failed); @@ -246,21 +277,43 @@ tc_tdm_output_unset(tdm_display *dpy, tdm_output *output) tdm_error ret; int count = 0; unsigned int pipe = 0; + tdm_hwc *thwc = NULL; + const tdm_output_mode *mode = NULL; + tdm_output_dpms dpms = TDM_OUTPUT_DPMS_OFF; + tdm_region fb_damage; + uint32_t num = 0; + + if (tc_tdm_output_is_hwc_enable(output)) { + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_mode(output, &mode) == TDM_ERROR_NONE); + if (mode == NULL) + return true; + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_dpms(output, &dpms) == TDM_ERROR_NONE); + if (dpms != TDM_OUTPUT_DPMS_ON) + return true; + + thwc = tdm_output_get_hwc(output, &ret); + TDM_UT_RETURN_FALSE_IF_FAIL(thwc != NULL); + + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_hwc_set_client_target_buffer(thwc, NULL, fb_damage) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_hwc_validate(thwc, NULL, 0, &num) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_hwc_accept_validation(thwc) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_hwc_commit(thwc, 0, NULL, NULL) == TDM_ERROR_NONE); + } else { + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_layer_count(output, &count) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(count > 0); - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_layer_count(output, &count) == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(count > 0); + for (int l = 0; l < count; l++) { + tdm_layer *layer = tdm_output_get_layer(output, l, &ret); + TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(layer != NULL); - for (int l = 0; l < count; l++) { - tdm_layer *layer = tdm_output_get_layer(output, l, &ret); - TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(layer != NULL); + if (tc_tdm_layer_is_cursor_layer(layer)) + continue; + if (tc_tdm_layer_is_video_layer(layer)) + continue; - if (tc_tdm_layer_is_cursor_layer(layer)) - continue; - if (tc_tdm_layer_is_video_layer(layer)) - continue; - - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_unset_buffer(layer) == TDM_ERROR_NONE); + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_unset_buffer(layer) == TDM_ERROR_NONE); + } } TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_pipe(output, &pipe) == TDM_ERROR_NONE); @@ -794,8 +847,12 @@ TEST_P(TDMOutput, OutputGetPrimaryIndex) for (int o = 0; o < output_count; o++) { int primary_index = TDM_UT_INVALID_VALUE; - ASSERT_EQ(tdm_output_get_primary_index(outputs[o], &primary_index), TDM_ERROR_NONE); - ASSERT_NE(primary_index, TDM_UT_INVALID_VALUE); + + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + ASSERT_EQ(tdm_output_get_primary_index(outputs[o], &primary_index), TDM_ERROR_NONE); + ASSERT_NE(primary_index, TDM_UT_INVALID_VALUE); + } else + TDM_UT_SKIP_FLAG(0); } } @@ -1450,13 +1507,16 @@ TEST_P(TDMOutput, OutputCommit) done1 = false; start = tdm_helper_get_time(); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); - while (!done1) - ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); - end = tdm_helper_get_time(); - - /* "+ interval" consider the delay of socket communication between kernel and platform */ - ASSERT_LT((end - start), (interval + interval)); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); + while (!done1) + ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + end = tdm_helper_get_time(); + + /* "+ interval" consider the delay of socket communication between kernel and platform */ + ASSERT_LT((end - start), (interval + interval)); + } else + TDM_UT_SKIP_FLAG(0); } } } @@ -1481,7 +1541,10 @@ TEST_P(TDMOutput, OutputCommitNullOther) continue; ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_ON), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + ASSERT_EQ(tdm_output_commit(outputs[o], 0, NULL, NULL), TDM_ERROR_NONE); + else + TDM_UT_SKIP_FLAG(0); } } @@ -1501,7 +1564,10 @@ TEST_P(TDMOutput, OutputCommitDpmsSuspend) ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_SUSPEND), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, NULL), TDM_ERROR_DPMS_OFF); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, NULL), TDM_ERROR_DPMS_OFF); + else + TDM_UT_SKIP_FLAG(0); } } @@ -1521,7 +1587,10 @@ TEST_P(TDMOutput, OutputCommitDpmsOff) ASSERT_EQ(tdm_output_set_dpms(outputs[o], TDM_OUTPUT_DPMS_OFF), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, NULL), TDM_ERROR_DPMS_OFF); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, NULL), TDM_ERROR_DPMS_OFF); + else + TDM_UT_SKIP_FLAG(0); } } @@ -1567,8 +1636,11 @@ TEST_P(TDMOutput, OutputCommitAfterLayerCommit) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); - ASSERT_EQ(tdm_output_get_primary_index(outputs[o], &index), TDM_ERROR_NONE); - ASSERT_NE(index, TDM_UT_INVALID_VALUE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + ASSERT_EQ(tdm_output_get_primary_index(outputs[o], &index), TDM_ERROR_NONE); + ASSERT_NE(index, TDM_UT_INVALID_VALUE); + } else + TDM_UT_SKIP_FLAG(0); layer = tdm_output_get_layer(outputs[o], index, &ret); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1609,12 +1681,15 @@ TEST_P(TDMOutput, OutputCommitFewTimesInOneVblank) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); for (int t = 0; t < 10; t++) { - done1 = done2 = done3 = false; - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); - while (!done1 || !done2 || !done3) - ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + done1 = done2 = done3 = false; + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); + while (!done1 || !done2 || !done3) + ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + } else + TDM_UT_SKIP_FLAG(0); } } } @@ -1640,13 +1715,16 @@ TEST_P(TDMOutput, OutputRemoveCommitHandler) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); for (int t = 0; t < 10; t++) { - done1 = done2 = done3 = false; - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); - tdm_output_remove_commit_handler(outputs[o], _tc_tdm_output_done_cb, &done2); - while (!done1 || done2 || !done3) - ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + done1 = done2 = done3 = false; + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); + tdm_output_remove_commit_handler(outputs[o], _tc_tdm_output_done_cb, &done2); + while (!done1 || done2 || !done3) + ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + } else + TDM_UT_SKIP_FLAG(0); } } } @@ -1666,13 +1744,16 @@ TEST_P(TDMOutput, OutputRemoveCommitHandlerDifferentData) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); for (int t = 0; t < 10; t++) { - done1 = done2 = done3 = false; - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); - tdm_output_remove_commit_handler(outputs[o], _tc_tdm_output_done_cb, NULL); - while (!done1 || !done2 || !done3) - ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + done1 = done2 = done3 = false; + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done1), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done2), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb, &done3), TDM_ERROR_NONE); + tdm_output_remove_commit_handler(outputs[o], _tc_tdm_output_done_cb, NULL); + while (!done1 || !done2 || !done3) + ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + } else + TDM_UT_SKIP_FLAG(0); } } } @@ -1692,12 +1773,15 @@ TEST_P(TDMOutput, OutputRemoveCommitHandlerInHandler) ASSERT_EQ(tc_tdm_output_prepare(dpy, outputs[o], true), true); for (int t = 0; t < 10; t++) { - done1 = done2 = done3 = false; - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done1), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done2), TDM_ERROR_NONE); - ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done3), TDM_ERROR_NONE); - while (!done1 || !done2 || !done3) - ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + if (!tc_tdm_output_is_hwc_enable(outputs[o])) { + done1 = done2 = done3 = false; + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done1), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done2), TDM_ERROR_NONE); + ASSERT_EQ(tdm_output_commit(outputs[o], 0, _tc_tdm_output_done_cb2, &done3), TDM_ERROR_NONE); + while (!done1 || !done2 || !done3) + ASSERT_EQ(tc_tdm_display_handle_events(dpy), TDM_ERROR_NONE); + } else + TDM_UT_SKIP_FLAG(0); } } } @@ -1712,4 +1796,4 @@ INSTANTIATE_TEST_CASE_P(TDMOutputParams, Values(TDM_DEFAULT_MODULE)); #endif -/* LCOV_EXCL_END */ \ No newline at end of file +/* LCOV_EXCL_END */ -- 2.7.4 From 1622e07c4116392a2129f31f17c9069cf70c1006 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 22 Jul 2019 19:07:33 +0900 Subject: [PATCH 14/16] add TDM_OUTPUT_CAPABILITY_MIRROR The backend can set the TDM_OUTPUT_CAPABILITY_MIRROR when it has the ability of the output mirroring. Change-Id: I34a6d86a2c7128b93a8b9acee1306b2caefad902 --- include/tdm_common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/tdm_common.h b/include/tdm_common.h index 70a081c..bfb4cc6 100644 --- a/include/tdm_common.h +++ b/include/tdm_common.h @@ -99,6 +99,7 @@ typedef enum { TDM_OUTPUT_CAPABILITY_ASYNC_DPMS = (1 << 0), /**< if a outupt supports asynchronous DPMS operation */ TDM_OUTPUT_CAPABILITY_HWC = (1 << 1), /**< if a outupt supports hwc operation @since 2.0.0*/ TDM_OUTPUT_CAPABILITY_EXTENDED_DPMS = (1 << 2), /**< if a outupt supports extended DPMS operation @since 2.0.0 */ + TDM_OUTPUT_CAPABILITY_MIRROR = (1 << 3), /**< if a outupt supports the displying mirror image of the src_output @since 2.9.0 */ } tdm_output_capability; /** -- 2.7.4 From 9bd49c10734de8b55679ecd3bb663200354bc5b7 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 22 Jul 2019 09:39:10 +0900 Subject: [PATCH 15/16] add tdm_output_set_mirror This function set the mirro image of the src_output to the output. If there is the hardware or the implementation to display the mirror image of the src_output to the output, the backend does it in this function. Change-Id: Ic661793af90ce4d87684d1f0bbcb14a5052e2585 --- include/tdm.h | 10 ++++++++++ include/tdm_backend.h | 18 +++++++++++++++++- src/tdm_output.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/include/tdm.h b/include/tdm.h index 71f7a1c..1c10a3c 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -649,6 +649,16 @@ tdm_hwc * tdm_output_get_hwc(tdm_output *output, tdm_error *error); /** + * @brief Set the mirror image of the src_output to the output + * @param[in] output A output object to display the src_output image + * @param[in] src_output A src output object of which image is displayed on the output + * @param[in] transform A transform value + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform transform); + +/** * @brief Get a output object of a layer object * @param[in] layer A layer object * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value. diff --git a/include/tdm_backend.h b/include/tdm_backend.h index c5db80a..4075f7b 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -558,7 +558,23 @@ typedef struct _tdm_func_output { */ tdm_hwc *(*output_get_hwc)(tdm_output *output, tdm_error *error); - void (*reserved3)(void); + /** + * @brief Set the mirror image of the src_output to the output + * @details This function set the mirro image of the src_output to the output. + * If there is the hardware or the implementation to display the mirror image + * of the src_output to the output, the backend does it in this function. + * If the backend output gets the ability of the mirror displaying, it has to + * set the TDM_OUTPUT_CAPABILITY_MIRROR on the output capability. + * @param[in] output A output object to display the src_output image + * @param[in] src_output A src output object of which image is displayed on the output + * @param[in] transform A transform value + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @see #TDM_OUTPUT_CAPABILITY_MIRROR + */ + tdm_error (*output_set_mirror)(tdm_output *output, + tdm_output *src_output, + tdm_transform transform); + void (*reserved4)(void); void (*reserved5)(void); void (*reserved6)(void); diff --git a/src/tdm_output.c b/src/tdm_output.c index 285887e..f4c818b 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -2027,6 +2027,52 @@ tdm_output_get_hwc(tdm_output *output, tdm_error *error) return private_hwc; } +EXTERN tdm_error +tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform transform) +{ + /* LCOV_EXCL_START */ + tdm_private_module *private_module; + tdm_func_output *func_output; + tdm_private_output *private_src_output; + + OUTPUT_FUNC_ENTRY(); + + TDM_RETURN_VAL_IF_FAIL(src_output != NULL, TDM_ERROR_INVALID_PARAMETER); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_output->private_module; + func_output = &private_module->func_output; + private_src_output = (tdm_private_output*)src_output; + + if (!(private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_MIRROR)) { + TDM_INFO("output(%d) doesn't support the mirror.", private_output->pipe); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_BAD_REQUEST; + } + + if (!func_output->output_set_mirror) { + TDM_WRN("not implemented!!"); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_output->output_set_mirror(private_output->output_backend, + private_src_output->output_backend, + transform); + if (ret != TDM_ERROR_NONE) { + TDM_ERR("output(%p) fails to set MIRROR.", private_output); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_BAD_REQUEST; + } + + _pthread_mutex_unlock(&private_display->lock); + + /* LCOV_EXCL_STOP */ + + return ret; +} + INTERN tdm_error tdm_output_choose_commit_per_vblank_mode(tdm_private_output *private_output, int mode) { -- 2.7.4 From 859f51f8606bff3235d75130635ade4e8a8ce338 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Mon, 22 Jul 2019 19:05:27 +0900 Subject: [PATCH 16/16] add tdm_output_unset_mirror This function unset the mirro image of the output. Change-Id: If67805ebf0d54f2097718c4e3dd3d02ed8d0d798 --- include/tdm.h | 8 ++++++++ include/tdm_backend.h | 10 +++++++++- src/tdm_output.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/include/tdm.h b/include/tdm.h index 1c10a3c..c334b20 100644 --- a/include/tdm.h +++ b/include/tdm.h @@ -659,6 +659,14 @@ tdm_error tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform transform); /** + * @brief Unset the mirror + * @param[in] output A output object + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + */ +tdm_error +tdm_output_unset_mirror(tdm_output *output); + +/** * @brief Get a output object of a layer object * @param[in] layer A layer object * @param[out] error #TDM_ERROR_NONE if success. Otherwise, error value. diff --git a/include/tdm_backend.h b/include/tdm_backend.h index 4075f7b..f9a1b22 100644 --- a/include/tdm_backend.h +++ b/include/tdm_backend.h @@ -569,11 +569,19 @@ typedef struct _tdm_func_output { * @param[in] src_output A src output object of which image is displayed on the output * @param[in] transform A transform value * @return #TDM_ERROR_NONE if success. Otherwise, error value. - * @see #TDM_OUTPUT_CAPABILITY_MIRROR + * @see #output_set_mirror, #TDM_OUTPUT_CAPABILITY_MIRROR */ tdm_error (*output_set_mirror)(tdm_output *output, tdm_output *src_output, tdm_transform transform); + /** + * @brief Unset the mirror image + * @details This function unset the mirro image of the output. + * @param[in] output A output object to display the src_output image + * @return #TDM_ERROR_NONE if success. Otherwise, error value. + * @see #output_set_mirror, #TDM_OUTPUT_CAPABILITY_MIRROR + */ + tdm_error (*output_unset_mirror)(tdm_output *output); void (*reserved4)(void); void (*reserved5)(void); diff --git a/src/tdm_output.c b/src/tdm_output.c index f4c818b..4605183 100644 --- a/src/tdm_output.c +++ b/src/tdm_output.c @@ -2068,9 +2068,47 @@ tdm_output_set_mirror(tdm_output *output, tdm_output *src_output, tdm_transform _pthread_mutex_unlock(&private_display->lock); + return ret; /* LCOV_EXCL_STOP */ +} + +tdm_error +tdm_output_unset_mirror(tdm_output *output) +{ + /* LCOV_EXCL_START */ + tdm_private_module *private_module; + tdm_func_output *func_output; + + OUTPUT_FUNC_ENTRY(); + + _pthread_mutex_lock(&private_display->lock); + + private_module = private_output->private_module; + func_output = &private_module->func_output; + + if (!(private_output->caps.capabilities & TDM_OUTPUT_CAPABILITY_MIRROR)) { + TDM_INFO("output(%d) doesn't support the mirror.", private_output->pipe); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_BAD_REQUEST; + } + + if (!func_output->output_unset_mirror) { + TDM_WRN("not implemented!!"); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_NOT_IMPLEMENTED; + } + + ret = func_output->output_unset_mirror(private_output->output_backend); + if (ret != TDM_ERROR_NONE) { + TDM_ERR("output(%p) fails to unset MIRROR.", private_output); + _pthread_mutex_unlock(&private_display->lock); + return TDM_ERROR_BAD_REQUEST; + } + + _pthread_mutex_unlock(&private_display->lock); return ret; + /* LCOV_EXCL_STOP */ } INTERN tdm_error -- 2.7.4