tc: add tests for tdm_hwc and tdm_hwc_window 29/181229/2
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 30 May 2018 01:39:46 +0000 (10:39 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 11 Jun 2018 07:02:31 +0000 (16:02 +0900)
Change-Id: Id19c9f11771397f60204ef5a6af07576f4da7f37

haltests/Makefile.am
haltests/src/tc_tdm_hwc.cpp [new file with mode: 0644]
haltests/src/tc_tdm_hwc_window.cpp
haltests/src/tc_tdm_output_hwc.cpp [deleted file]

index 276b503..278e1ef 100644 (file)
@@ -15,7 +15,9 @@ tdm_haltests_SOURCES = \
        src/tc_tdm_backend_env.cpp \
        src/tc_tdm_backend_display.cpp \
        src/tc_tdm_backend_pp.cpp \
-       src/tc_tdm_backend_capture.cpp
+       src/tc_tdm_backend_capture.cpp \
+       src/tc_tdm_hwc.cpp \
+       src/tc_tdm_hwc_window.cpp
 
 tdm_haltests_SOURCES += \
        ../tools/buffers.c
diff --git a/haltests/src/tc_tdm_hwc.cpp b/haltests/src/tc_tdm_hwc.cpp
new file mode 100644 (file)
index 0000000..545c6a0
--- /dev/null
@@ -0,0 +1,525 @@
+/**************************************************************************
+ *
+ * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
+ * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
+ * Contact: Roman Marchenko <r.marchenko@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+**************************************************************************/
+
+#include "tc_tdm.h"
+
+/* LCOV_EXCL_START */
+
+#define HWC_WIN_NUM 5
+
+class TDMHwc : public TDMOutput
+{
+public:
+       TDMHwc();
+       void SetUp(void);
+       void TearDown(void);
+
+       tdm_error error;
+};
+
+TDMHwc::TDMHwc()
+{
+       error = TDM_ERROR_NONE;
+}
+
+void TDMHwc::SetUp(void)
+{
+       TDMOutput::SetUp();
+}
+
+void TDMHwc::TearDown(void)
+{
+       TDMOutput::TearDown();
+}
+
+static void
+_tc_tdm_hwc_commit_cb(tdm_hwc *hwc, unsigned int sequence,
+                                               unsigned int tv_sec, unsigned int tv_usec,
+                                               void *user_data)
+{
+       bool *done = (bool*)user_data;
+       if (done)
+               *done = true;
+}
+
+/* tdm_hwc_window * tdm_hwc_create_window(tdm_output *output, tdm_error *error); */
+TEST_P(TDMHwc, CreateWindowFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       ASSERT_EQ(NULL, tdm_hwc_create_window(NULL, &error));
+       ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMHwc, CreateWindowSuccessful)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error;
+       tdm_hwc_window * hw = NULL;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       hw = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hw);
+               } else {
+                       ASSERT_EQ(NULL, tdm_hwc_create_window(hwc, &error));
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+/* tdm_hwc_get_supported_formats() */
+TEST_P(TDMHwc, GetSupportedFormatsFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_error error;
+
+       error = tdm_hwc_get_supported_formats(NULL, NULL, NULL);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMHwc, GetSupportedFormatsSuccessful)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       const tbm_format *formats;
+       int count;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_get_supported_formats(hwc, &formats, &count);
+                       if (error != TDM_ERROR_NOT_IMPLEMENTED) {
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               if (count > 0)
+                                       ASSERT_NE(NULL, formats);
+                       }
+               } else {
+                       error = tdm_hwc_get_supported_formats(hwc, &formats, &count);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+/* tdm_hwc_get_available_properties() */
+TEST_P(TDMHwc, GetAvailablePropertiesFailNullWin)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       const tdm_prop *props;
+       int count;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_get_available_properties(NULL, &props, &count);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+
+                       error = tdm_hwc_get_available_properties(hwc, NULL, &count);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+
+                       error = tdm_hwc_get_available_properties(hwc, &props, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               } else {
+                       error = tdm_hwc_get_available_properties(hwc, &props, &count);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+TEST_P(TDMHwc, GetAvailablePropertiesSuccess)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       const tdm_prop *props;
+       int count;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_get_available_properties(hwc, &props, &count);
+                       ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error);
+               } else {
+                       error = tdm_hwc_get_available_properties(hwc, &props, &count);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+
+}
+
+/* tdm_hwc_get_client_target_buffer_queue() */
+TEST_P(TDMHwc, GetClientTargetBufferQueueFailNullObject)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tbm_surface_queue_h queue = NULL;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       queue = tdm_hwc_get_client_target_buffer_queue(NULL, &error);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       ASSERT_EQ(NULL, queue);
+
+                       queue = tdm_hwc_get_client_target_buffer_queue(NULL, NULL);
+                       ASSERT_EQ(NULL, queue);
+               } else {
+                       ASSERT_EQ(NULL, queue);
+               }
+       }
+}
+
+TEST_P(TDMHwc, GetClientTargetBufferQueueFainNoHwc)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tbm_surface_queue_h queue = NULL;
+
+       for (int o = 0; o < output_count; o++) {
+               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);
+               } else {
+                       queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       ASSERT_EQ(NULL, queue);
+               }
+       }
+}
+
+TEST_P(TDMHwc, GetClientTargetBufferQueueSuccessful)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tbm_surface_queue_h queue = NULL;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error);
+                       tbm_surface_queue_destroy(queue);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+                       ASSERT_NE(NULL, queue);
+
+                       queue = tdm_hwc_get_client_target_buffer_queue(hwc, NULL);
+                       tbm_surface_queue_destroy(queue);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+                       ASSERT_NE(NULL, queue);
+               } else {
+                       queue = tdm_hwc_get_client_target_buffer_queue(hwc, &error);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       ASSERT_EQ(NULL, queue);
+
+                       queue = tdm_hwc_get_client_target_buffer_queue(hwc, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       ASSERT_EQ(NULL, queue);
+               }
+       }
+}
+
+/* tdm_hwc_set_client_target_buffer() */
+TEST_P(TDMHwc, SetClientTargetBufferFailNullOutput)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_region damage = {.num_rects = 0, .rects = NULL};
+       tbm_surface_h target_buff = NULL;
+
+       target_buff = tbm_surface_internal_create_with_flags(720, 1024,
+                                                                       TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
+       ASSERT_NE(NULL, target_buff);
+
+       error = tdm_hwc_set_client_target_buffer(NULL, target_buff, damage);
+       tbm_surface_internal_destroy(target_buff);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMHwc, SetClientTargetBufferSuccessfulSetBuff)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tdm_region damage = {.num_rects = 0, .rects = NULL};
+       const tdm_output_mode *mode = NULL;
+       tbm_surface_h target_buff = NULL;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       ASSERT_EQ(tdm_output_get_mode(outputs[o], &mode), TDM_ERROR_NONE);
+                       target_buff = tbm_surface_internal_create_with_flags(mode->hdisplay, mode->vdisplay,
+                                                                       TBM_FORMAT_ARGB8888, TBM_BO_DEFAULT);
+                       ASSERT_NE(NULL, target_buff);
+
+                       error = tdm_hwc_set_client_target_buffer(hwc, target_buff, damage);
+                       tbm_surface_internal_destroy(target_buff);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+               } else {
+                       error = tdm_hwc_set_client_target_buffer(hwc, target_buff, damage);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+TEST_P(TDMHwc, SetClientTargetBufferSuccessfulResetBuff)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       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++) {
+               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);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+/* tdm_hwc_validate() */
+TEST_P(TDMHwc, ValidateFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       uint32_t num_types;
+
+       error = tdm_hwc_validate(NULL, NULL, 0, &num_types);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_validate(hwc, NULL, 0, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               } else {
+                       error = tdm_hwc_validate(hwc, NULL, 0, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+/* tdm_hwc_get_changed_composition_types() */
+TEST_P(TDMHwc, GetChangedCompositionTypesFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       uint32_t num_elements;
+
+       error = tdm_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_get_changed_composition_types(hwc, NULL, NULL, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               } else {
+                       error = tdm_hwc_get_changed_composition_types(hwc, NULL, NULL, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+/* tdm_error tdm_hwc_accept_changes() */
+TEST_P(TDMHwc, AcceptChangesFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       error = tdm_hwc_accept_changes(NULL);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMHwc, AcceptChangesFailNoHwc)
+{
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       error = tdm_hwc_accept_changes(hwc);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               } else {
+                       error = tdm_hwc_accept_changes(hwc);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+               }
+       }
+}
+
+TEST_P(TDMHwc, AcceptChangesSuccessful)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tdm_hwc_window *hwc_wnds[HWC_WIN_NUM];
+       tdm_hwc_window **changed_hwc_window = NULL;
+       tdm_hwc_window_composition *composition_types = NULL;
+       uint32_t num_types;
+       uint32_t get_num = 0;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       for (int w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wnds[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               error = tdm_hwc_window_set_composition_type(hwc_wnds[w], TDM_COMPOSITION_DEVICE);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       }
+
+                       error = tdm_hwc_validate(hwc, hwc_wnds, HWC_WIN_NUM, &num_types);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+
+                       if (num_types > 0) {
+                               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));
+
+                               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_changes(hwc);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+
+                               free(composition_types);
+                               free(changed_hwc_window);
+                       }
+
+                       for (int w = 0; w < HWC_WIN_NUM; w++)
+                               tdm_hwc_window_destroy(hwc_wnds[w]);
+
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       }
+       }
+}
+
+/* tdm_error tdm_hwc_commit() */
+TEST_P(TDMHwc, CommitFailNull)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       error = tdm_hwc_commit(NULL, 1, NULL, NULL);
+       ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMHwc, CommitSuccessful)
+{
+       TDM_UT_SKIP_FLAG(has_outputs);
+
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
+       tdm_hwc_window *hwc_wnds[HWC_WIN_NUM];
+       tdm_hwc_window **changed_hwc_window = NULL;
+       tdm_hwc_window_composition *composition_types = NULL;
+       uint32_t num_types;
+       uint32_t get_num = 0;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(outputs[o], &error);
+               if (hwc) {
+                       for (int w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wnds[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               error = tdm_hwc_window_set_composition_type(hwc_wnds[w], TDM_COMPOSITION_DEVICE);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       }
+
+                       error = tdm_hwc_validate(hwc, hwc_wnds, HWC_WIN_NUM, &num_types);
+                       ASSERT_EQ(TDM_ERROR_NONE, error);
+
+                       if (num_types > 0) {
+                               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));
+
+                               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_changes(hwc);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+
+                               free(composition_types);
+                               free(changed_hwc_window);
+                       }
+
+                       error = tdm_hwc_commit(hwc, 0, _tc_tdm_hwc_commit_cb, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+
+                       for (int w = 0; w < HWC_WIN_NUM; w++)
+                               tdm_hwc_window_destroy(hwc_wnds[w]);
+
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       }
+       }
+}
+
+#ifdef TDM_UT_TEST_WITH_PARAMS
+INSTANTIATE_TEST_CASE_P(TDMHwcParams,
+                                               TDMHwc,
+                                               Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE)));
+#else
+INSTANTIATE_TEST_CASE_P(TDMHwcParams,
+                                               TDMHwc,
+                                               Values(TDM_DEFAULT_MODULE));
+#endif
+
+/* LCOV_EXCL_END */
\ No newline at end of file
index 3af1f35..b330e85 100644 (file)
@@ -40,50 +40,23 @@ public:
        TDMHwcWindow();
        void SetUp(void);
        void TearDown(void);
-
-       tdm_error error;
-       tdm_hwc_window **hwc_wins;
-       int hwc_count;
 };
 
 TDMHwcWindow::TDMHwcWindow()
 {
-       error = TDM_ERROR_NONE;
-       hwc_wins = NULL;
-       hwc_count = 0;
-       video_hwc_win = NULL;
 }
 
 void TDMHwcWindow::SetUp(void)
 {
-       tdm_hwc_window *hw = NULL;
-
        TDMOutput::SetUp();
-
-       hwc_wins = (tdm_hwc_window **)calloc(output_count * HWC_WIN_NUM, sizeof(tdm_hwc_window *));
-
-       //create HWC_WIN_NUM hwc_windows for each outputs
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       for (int w = 0; w < HWC_WIN_NUM; w++) {
-                               hw = tdm_hwc_create_window(outputs[w], &error);
-                               ASSERT_EQ(TDM_ERROR_NONE, error);
-                               hwc_wins[hwc_count++] = hw;
-                       }
-               }
-       }
 }
 
 void TDMHwcWindow::TearDown(void)
 {
-       for (int w = 0; w < hwc_count; w++)
-               tdm_hwc_window_destroy(hwc_wins[w]);
-
        TDMOutput::TearDown();
 }
 
-/* void tdm_hwc_window_destroy(tdm_hwc_window *hwc_window); */
-/*
+/* void tdm_hwc_window_destroy() */
 TEST_P(TDMHwcWindow, DestroyWindowFailNull)
 {
        tdm_hwc_window_destroy(NULL);
@@ -93,24 +66,27 @@ TEST_P(TDMHwcWindow, DestroyWindowSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_hwc_window *hw = NULL;
 
        for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       hw = tdm_hwc_create_window(outputs[o], &error);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-                       error = tdm_hwc_window_destroy(outputs[o], hw);
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hw = tdm_hwc_create_window(hwc, &error);
                        ASSERT_EQ(TDM_ERROR_NONE, error);
+                       if (hw)
+                               tdm_hwc_window_destroy(hw);
                }
        }
 }
-*/
 
-/* tbm_surface_queue_h tdm_hwc_window_get_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error); */
+/* tbm_surface_queue_h tdm_hwc_window_get_buffer_queue() */
 TEST_P(TDMHwcWindow, GetBufferQueueFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_error error = TDM_ERROR_NONE;
        tbm_surface_queue_h queue = NULL;
 
        queue = tdm_hwc_window_get_buffer_queue(NULL, &error);
@@ -125,27 +101,44 @@ TEST_P(TDMHwcWindow, GetBufferQueueSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_wins[HWC_WIN_NUM];
+       tdm_error error = TDM_ERROR_NONE;
+       int w;
        tbm_surface_queue_h queue = NULL;
        tdm_hwc_window_info info = { 0 };
 
-       info.src_config.format = TBM_FORMAT_ARGB8888;
-       info.src_config.size.h = info.src_config.size.v = 256;
-       info.src_config.pos.h = info.src_config.pos.w = 256;
-       info.dst_pos.h = info.dst_pos.w = 256;
-       info.transform = TDM_TRANSFORM_NORMAL;
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       for (w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wins[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_NE(NULL, hwc_wins[w]);
+                       }
+
+                       info.src_config.format = TBM_FORMAT_ARGB8888;
+                       info.src_config.size.h = info.src_config.size.v = 256;
+                       info.src_config.pos.h = info.src_config.pos.w = 256;
+                       info.dst_pos.h = info.dst_pos.w = 256;
+                       info.transform = TDM_TRANSFORM_NORMAL;
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_info(hwc_wins[w], &info);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       for (w = 0; w < HWC_WIN_NUM; w++) {
+                               error = tdm_hwc_window_set_info(hwc_wins[w], &info);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
 
-               queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], &error);
-               tbm_surface_queue_destroy(queue);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-               ASSERT_NE(NULL, queue);
+                               queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], &error);
+                               tbm_surface_queue_destroy(queue);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               ASSERT_NE(NULL, queue);
 
-               queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], NULL);
-               tbm_surface_queue_destroy(queue);
-               ASSERT_NE(NULL, queue);
+                               queue = tdm_hwc_window_get_buffer_queue(hwc_wins[w], NULL);
+                               tbm_surface_queue_destroy(queue);
+                               ASSERT_NE(NULL, queue);
+                       }
+
+                       for (w = 0; w < HWC_WIN_NUM; w++)
+                               tdm_hwc_window_destroy(hwc_wins[w]);
+               }
        }
 }
 
@@ -155,39 +148,70 @@ TEST_P(TDMHwcWindow, SetCompositionTypeFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_error error = TDM_ERROR_NONE;
+
        error = tdm_hwc_window_set_composition_type(NULL, TDM_COMPOSITION_DEVICE);
        ASSERT_NE(TDM_ERROR_NONE, error);
 }
 
-TEST_P(TDMHwcWindow, SetCompositionTypeSuccessful)
+TEST_P(TDMHwcWindow, SetCompositionTypeFailInvalieCompositionType)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_DEVICE);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CLIENT);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CURSOR);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_set_composition_type(hwc_win, tdm_hwc_window_composition(TDM_COMPOSITION_NONE - 1));
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
        }
 }
 
-TEST_P(TDMHwcWindow, SetCompositionTypeFailInvalieCompositionType)
+TEST_P(TDMHwcWindow, SetCompositionTypeSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_composition_type(hwc_wins[w], tdm_hwc_window_composition(TDM_COMPOSITION_NONE - 1));
-               ASSERT_NE(TDM_ERROR_NONE, error);
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_wins[HWC_WIN_NUM];
+       tdm_error error = TDM_ERROR_NONE;
+       int w;
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       for (w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wins[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_NE(NULL, hwc_wins[w]);
+                       }
+
+                       for (w = 0; w < HWC_WIN_NUM; w++) {
+                               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_DEVICE);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CLIENT);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               error = tdm_hwc_window_set_composition_type(hwc_wins[w], TDM_COMPOSITION_CURSOR);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                       }
+
+                       for (w = 0; w < HWC_WIN_NUM; w++)
+                               tdm_hwc_window_destroy(hwc_wins[w]);
+               }
        }
 }
 
-/* tdm_error tdm_hwc_window_set_buffer_damage(tdm_hwc_window *hwc_window, tdm_region damage); */
+/* tdm_error tdm_hwc_window_set_buffer_damage() */
 TEST_P(TDMHwcWindow, SetBufferDamageFailNullHwcWindow)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_error error = TDM_ERROR_NONE;
        tdm_region damage = {.num_rects = 0, .rects = NULL};
 
        error = tdm_hwc_window_set_buffer_damage(NULL, damage);
@@ -198,42 +222,69 @@ TEST_P(TDMHwcWindow, SetBufferDamageFailNullDamageRects)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_region damage = {.num_rects = 1, .rects = NULL};
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage);
-               ASSERT_NE(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_set_buffer_damage(hwc_win, damage);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
        }
 }
 
-
 TEST_P(TDMHwcWindow, SetBufferDamageSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_wins[HWC_WIN_NUM];
+       tdm_error error = TDM_ERROR_NONE;
        tdm_pos const rects[1] = {0};
        tdm_region damage = {.num_rects = 1, .rects = rects};
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       for (int w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wins[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_NE(NULL, hwc_wins[w]);
+                               error = tdm_hwc_window_set_buffer_damage(hwc_wins[w], damage);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
+                               tdm_hwc_window_destroy(hwc_wins[w]);
+                       }
+               }
        }
 }
 
-
-/* tdm_error tdm_hwc_window_set_info(tdm_hwc_window *hwc_window, tdm_hwc_window_info *info); */
+/* tdm_error tdm_hwc_window_set_info() */
 TEST_P(TDMHwcWindow, SetInfoFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_hwc_window_info info = { 0 };
 
        error = tdm_hwc_window_set_info(NULL, &info);
        ASSERT_NE(TDM_ERROR_NONE, error);
 
-       if (hwc_count > 0) {
-               error = tdm_hwc_window_set_info(hwc_wins[0], NULL);
-               ASSERT_NE(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_set_info(hwc_win, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
        }
 }
 
@@ -241,20 +292,30 @@ TEST_P(TDMHwcWindow, SetInfoSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_hwc_window_info info = { 0 };
 
-       for (int w = 0; w < hwc_count; w++) {
-               error = tdm_hwc_window_set_info(hwc_wins[w], &info);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_set_info(hwc_win, &info);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
        }
 }
 
-
-/* tdm_error tdm_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h buffer); */
+/* tdm_error tdm_hwc_window_set_buffer() */
 TEST_P(TDMHwcWindow, SetBufferFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
+       tdm_error error = TDM_ERROR_NONE;
+
        error = tdm_hwc_window_set_buffer(NULL, NULL);
        ASSERT_NE(TDM_ERROR_NONE, error);
 }
@@ -263,106 +324,116 @@ TEST_P(TDMHwcWindow, SetBufferSuccessful)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
 
-       for (int w = 0; w < hwc_count; w++) {
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_wins[HWC_WIN_NUM];
+       tdm_error error = TDM_ERROR_NONE;
+       tbm_surface_h buffer = NULL;
 
-               tbm_surface_h buff = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
-
-               /* test: set*/
-               error = tdm_hwc_window_set_buffer(hwc_wins[w], buff);
-               tbm_surface_destroy(buff);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-
-               /* test: reset*/
-               error = tdm_hwc_window_set_buffer(hwc_wins[w], NULL);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-       }
-}
-
-/* tdm_hwc_get_available_properties() */
-/*
-TEST_P(TDMHwcWindow, GetAvailablePropertiesFailNullWin)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
-       const tdm_prop *props;
-       int count;
-
-       error = tdm_hwc_get_available_properties(NULL, &props, &count);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       error = tdm_hwc_get_available_properties(video_hwc_win, NULL, &count);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       error = tdm_hwc_get_available_properties(video_hwc_win, &props, NULL);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-}
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       for (int w = 0; w < HWC_WIN_NUM; w++) {
+                               hwc_wins[w] = tdm_hwc_create_window(hwc, &error);
+                               ASSERT_NE(NULL, hwc_wins[w]);
 
-TEST_P(TDMHwcWindow, GetAvailablePropertiesSuccess)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
+                               buffer = tbm_surface_create(256, 256, TBM_FORMAT_ARGB8888);
+                               ASSERT_NE(NULL, buffer);
 
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
+                               error = tdm_hwc_window_set_buffer(hwc_wins[w], buffer);
+                               tbm_surface_destroy(buffer);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
 
-       const tdm_prop *props;
-       int count;
+                               /* set NULL to the buffer */
+                               error = tdm_hwc_window_set_buffer(hwc_wins[w], NULL);
+                               ASSERT_EQ(TDM_ERROR_NONE, error);
 
-       error = tdm_hwc_get_available_properties(video_hwc_win, &props, &count);
-       ASSERT_TRUE(TDM_ERROR_NONE == error || TDM_ERROR_NOT_IMPLEMENTED == error);
+                               tdm_hwc_window_destroy(hwc_wins[w]);
+                       }
+               }
+       }
 }
-*/
 
-/* tdm_hwc_window_get_property() */
-TEST_P(TDMHwcWindow, GetPropertyFailNull)
+/* tdm_hwc_window_set_property() */
+TEST_P(TDMHwcWindow, SetPropertyFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
 
+       tdm_error error = TDM_ERROR_NONE;
        tdm_value value;
        int id = 1;
 
-       error = tdm_hwc_window_get_property(NULL, id, &value);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       error = tdm_hwc_window_get_property(video_hwc_win, id, NULL);
+       error = tdm_hwc_window_set_property(NULL, id, value);
        ASSERT_NE(TDM_ERROR_NONE, error);
 }
 
-TEST_P(TDMHwcWindow, GetPropertyFailWrongId)
+TEST_P(TDMHwcWindow, SetPropertyFailWrongId)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_value value;
        int id = INT_MAX;
 
-       error = tdm_hwc_window_get_property(video_hwc_win, id, &value);
-       ASSERT_NE(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_set_property(hwc_win, id, value);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
+       }
 }
 
-/* tdm_hwc_window_set_property() */
-TEST_P(TDMHwcWindow, SetPropertyFailNull)
+/* tdm_hwc_window_get_property() */
+TEST_P(TDMHwcWindow, GetPropertyFailNull)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_value value;
        int id = 1;
 
-       error = tdm_hwc_window_set_property(NULL, id, value);
+       error = tdm_hwc_window_get_property(NULL, id, &value);
        ASSERT_NE(TDM_ERROR_NONE, error);
+
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_get_property(hwc_win, id, NULL);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
+       }
 }
 
-TEST_P(TDMHwcWindow, SetPropertyFailWrongId)
+TEST_P(TDMHwcWindow, GetPropertyFailWrongId)
 {
        TDM_UT_SKIP_FLAG(has_outputs);
-       TDM_UT_SKIP_FLAG(video_hwc_win != NULL);
 
+       tdm_hwc *hwc = NULL;
+       tdm_hwc_window *hwc_win;
+       tdm_error error = TDM_ERROR_NONE;
        tdm_value value;
        int id = INT_MAX;
 
-       error = tdm_hwc_window_set_property(video_hwc_win, id, value);
-       ASSERT_NE(TDM_ERROR_NONE, error);
+       for (int o = 0; o < output_count; o++) {
+               hwc = tdm_output_get_hwc(hwc, &error);
+               if (hwc) {
+                       hwc_win = tdm_hwc_create_window(hwc, &error);
+                       ASSERT_NE(NULL, hwc_win);
+                       error = tdm_hwc_window_get_property(hwc_win, id, &value);
+                       ASSERT_NE(TDM_ERROR_NONE, error);
+                       tdm_hwc_window_destroy(hwc_win);
+               }
+       }
 }
 
 #ifdef TDM_UT_TEST_WITH_PARAMS
diff --git a/haltests/src/tc_tdm_output_hwc.cpp b/haltests/src/tc_tdm_output_hwc.cpp
deleted file mode 100644 (file)
index 3a6ca4d..0000000
+++ /dev/null
@@ -1,429 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2016 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Contact: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
- * Contact: Andrii Sokolenko <a.sokolenko@samsung.com>
- * Contact: Roman Marchenko <r.marchenko@samsung.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
-**************************************************************************/
-
-#include "tc_tdm.h"
-
-/* LCOV_EXCL_START */
-
-class TDMOutputHwc : public TDMOutput
-{
-public:
-       TDMOutputHwc();
-       void SetUp(void);
-       void TearDown(void);
-
-       tdm_error error;
-};
-
-TDMOutputHwc::TDMOutputHwc()
-{
-       error = TDM_ERROR_NONE;
-}
-
-void TDMOutputHwc::SetUp(void)
-{
-       TDMOutput::SetUp();
-}
-
-void TDMOutputHwc::TearDown(void)
-{
-       TDMOutput::TearDown();
-}
-
-/* tdm_hwc_window * tdm_hwc_create_window(tdm_output *output, tdm_error *error); */
-TEST_P(TDMOutputHwc, CreateWindowFailNull)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       ASSERT_EQ(NULL, tdm_hwc_create_window(NULL, &error));
-       ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-/*
-TEST_P(TDMOutputHwc, CreateWindowSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_hwc_window * hw = NULL;
-
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       hw = tdm_hwc_create_window(hwc[o], &error);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-                       tdm_hwc_window_destroy(hw);
-               } else {
-                       ASSERT_EQ(NULL, tdm_hwc_create_window(outputs[o], &error));
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-*/
-
-/* tdm_error tdm_hwc_set_client_target_buffer(tdm_output *output,
-                                                                                tbm_surface_h target_buffer, tdm_region damage,
-                                                                                tdm_hwc_window *composited_wnds, uint32_t num_wnds); */
-/* TDOO: need to be fixed
-TEST_P(TDMOutputHwc, SetClientTargetBufferFailNullOutput)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_region reg;
-       tbm_surface_h target_buff = CreateBufferForOutput(0);
-       error = tdm_hwc_set_client_target_buffer(NULL, target_buff, reg, NULL, 0 );
-       tbm_surface_internal_destroy(target_buff);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_P(TDMOutputHwc, SetClientTargetBufferFailNoHwc)
-{
-       tdm_region damage = {.num_rects = 0, .rects = NULL};
-
-       for (int o = 0; o < output_count; o++) {
-               tbm_surface_h target_buff = CreateBufferForOutput(i);
-               ASSERT_NE(NULL, target_buff);
-               error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage, NULL, 0);
-               tbm_surface_internal_destroy(target_buff);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-
-TEST_P(TDMOutputHwc, SetClientTargetBufferSuccessfulSetBuff)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_region damage = {.num_rects = 0, .rects = NULL};
-
-       for (int o = 0; o < output_count; o++) {
-               tbm_surface_h target_buff = CreateBufferForOutput(i);
-               ASSERT_NE(NULL, target_buff);
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage,
-                                       NULL, 0);
-                       tbm_surface_internal_destroy(target_buff);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-               } else {
-                       error = tdm_hwc_set_client_target_buffer(outputs[o], target_buff, damage,
-                                       NULL, 0);
-                       tbm_surface_internal_destroy(target_buff);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-
-TEST_P(TDMOutputHwc, SetClientTargetBufferSuccessfulResetBuff)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_region damage = {.num_rects = 0, .rects = NULL};
-
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_set_client_target_buffer(outputs[o], NULL, damage,
-                                       NULL, 0);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-               } else {
-                       error = tdm_hwc_set_client_target_buffer(outputs[o], NULL, damage,
-                                       NULL, 0);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-*/
-
-/* tbm_surface_queue_h tdm_hwc_get_client_target_buffer_queue(tdm_output *output, tdm_error *error); */
-/*
-TEST_P(TDMOutputHwc, GetTargetBufferQueueFailNullObject)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tbm_surface_queue_h queue = NULL;
-
-       queue = tdm_hwc_get_client_target_buffer_queue(NULL, &error);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-       ASSERT_EQ(NULL, queue);
-
-       queue = tdm_hwc_get_client_target_buffer_queue(NULL, NULL);
-       ASSERT_EQ(NULL, queue);
-}
-
-TEST_P(TDMOutputHwc, GetTargetBufferQueueFainNoHwc)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tbm_surface_queue_h queue = NULL;
-
-       for (int o = 0; o < output_count; o++) {
-               queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-               ASSERT_EQ(NULL, queue);
-       }
-}
-*/
-
-TEST_P(TDMOutputHwc, GetTargetBufferQueueSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tbm_surface_queue_h queue = NULL;
-
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error);
-                       tbm_surface_queue_destroy(queue);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-                       ASSERT_NE(NULL, queue);
-
-                       queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], NULL);
-                       tbm_surface_queue_destroy(queue);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-                       ASSERT_NE(NULL, queue);
-               } else {
-                       queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], &error);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-                       ASSERT_EQ(NULL, queue);
-
-                       queue = tdm_hwc_get_client_target_buffer_queue(outputs[o], NULL);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-                       ASSERT_EQ(NULL, queue);
-               }
-       }
-}
-
-/* tdm_error tdm_hwc_validate(tdm_output *output, tdm_hwc_window **composited_wnds, uint32_t num_wnds,
-                                       uint32_t *num_types); */
-/* TODO: fix the validate test later.
-TEST_P(TDMOutputHwc, ValidateFailNull)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t num_types;
-       error = tdm_hwc_validate(NULL, NULL, 0, &num_types);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       if (outputs[0]) {
-               error = tdm_hwc_validate(outputs[0], NULL, 0, NULL);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-
-TEST_P(TDMOutputHwc, ValidateFailNoHwc)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t num_types;
-
-       for (int o = 0; o < output_count; o++) {
-               error = tdm_hwc_validate(outputs[o], &num_types);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-
-TEST_P(TDMOutputHwc, ValidateSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t num_types;
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_validate(outputs[o], &num_types);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-               } else {
-                       error = tdm_hwc_validate(outputs[o], &num_types);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-TODO: */
-
-/* tdm_error tdm_hwc_get_changed_composition_types(tdm_hwc *hwc,
-                                                                                uint32_t *num_elements, tdm_hwc_window **hwc_window,
-                                                                                tdm_hwc_window_composition *composition_types); */
-/*
-TEST_P(TDMOutputHwc, GetChangedCompositionTypesFailNull)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t num_elements;
-
-       error = tdm_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-
-       if (outputs[0]) {
-               error = tdm_hwc_get_changed_composition_types(outputs[0], NULL, NULL, NULL);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-
-TEST_P(TDMOutputHwc, GetChangedCompositionTypesFailNoHwc)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t get_num = 10;
-
-       for (int o = 0; o < output_count; o++) {
-               error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-*/
-/* TODO: fix the validate test later.
-TEST_P(TDMHwcWindow, GetChangedCompositionTypesSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t validate_num;
-       uint32_t get_num = 0;
-
-       tdm_hwc_window_composition *composition_types;
-       tdm_hwc_window **hwc_wnds;
-
-       for (int i = 0; i < hwc_count; i++) {
-               error = tdm_hwc_window_set_composition_type(hwc_wins[o], TDM_COMPOSITION_DEVICE);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-       }
-
-
-       for (int i = 0; i < output_count; i++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_validate(outputs[o], &validate_num);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-
-                       error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-
-                       ASSERT_EQ(get_num, validate_num);
-                       hwc_wnds = (tdm_hwc_window **)calloc(get_num, sizeof(tdm_hwc_window *));
-                       composition_types = (tdm_hwc_window_composition *)calloc(get_num, sizeof(tdm_hwc_window_composition));
-
-                       error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, hwc_wnds, composition_types);
-
-                       free(hwc_wnds);
-                       free(composition_types);
-
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-               } else {
-                       error = tdm_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-*/
-
-/* tdm_error tdm_hwc_accept_changes(tdm_hwc *hwc); */
-/*
-TEST_P(TDMOutputHwc, AcceptChangesFailNull)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       error = tdm_hwc_accept_changes(NULL);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_P(TDMOutputHwc, AcceptChangesFailNoHwc)
-{
-       for (int o = 0; o < output_count; o++) {
-               error = tdm_hwc_accept_changes(outputs[o]);
-               ASSERT_NE(TDM_ERROR_NONE, error);
-       }
-}
-*/
-/* TODO: fix the validate test later.
-TEST_P(TDMHwcWindow, AcceptChangesSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       uint32_t validate_num;
-
-       for (int i = 0; i < hwc_count; i++) {
-               error = tdm_hwc_window_set_composition_type(hwc_wins[o], TDM_COMPOSITION_DEVICE);
-               ASSERT_EQ(TDM_ERROR_NONE, error);
-       }
-
-       for (int i = 0; i < output_count; i++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_validate(outputs[o], &validate_num);
-                       ASSERT_EQ(TDM_ERROR_NONE, error);
-
-                       if (validate_num > 0) {
-                               error =  tdm_hwc_accept_changes(outputs[o]);
-                               ASSERT_EQ(TDM_ERROR_NONE, error);
-                       }
-               }
-       }
-}
-*/
-
-/* tdm_hwc_get_supported_formats() */
-/*
-TEST_P(TDMOutputHwc, GetVideoSupportedFormatsFailNull)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_error error;
-
-       error = tdm_hwc_get_supported_formats(NULL, NULL, NULL);
-       ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_P(TDMOutputHwc, GetVideoSupportedFormatsSuccessful)
-{
-       TDM_UT_SKIP_FLAG(has_outputs);
-
-       tdm_error error;
-       const tbm_format *formats;
-       int count;
-
-       for (int o = 0; o < output_count; o++) {
-               if (tc_tdm_output_is_hwc_enable(outputs[o])) {
-                       error = tdm_hwc_get_supported_formats(outputs[o], &formats, &count);
-                       if (error != TDM_ERROR_NOT_IMPLEMENTED) {
-                               ASSERT_EQ(TDM_ERROR_NONE, error);
-                               if (count > 0)
-                                       ASSERT_NE(NULL, formats);
-                       }
-               } else {
-                       error = tdm_hwc_get_supported_formats(outputs[o], &formats, &count);
-                       ASSERT_NE(TDM_ERROR_NONE, error);
-               }
-       }
-}
-*/
-
-#ifdef TDM_UT_TEST_WITH_PARAMS
-INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams,
-                                               TDMOutputHwc,
-                                               Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE)));
-#else
-INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams,
-                                               TDMOutputHwc,
-                                               Values(TDM_DEFAULT_MODULE));
-#endif
-
-/* LCOV_EXCL_END */
\ No newline at end of file