};
-/* tdm_hwc_window * tdm_output_hwc_create_window(tdm_output *output, tdm_error *error); */
-TEST_F(TDMOutputHwc, CreateWindowFailNull)
-{
- ASSERT_EQ(NULL, tdm_output_hwc_create_window(NULL, &error));
- ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_F(TDMOutputHwc, CreateWindowSuccessful)
-{
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- tdm_hwc_window * hw = tdm_output_hwc_create_window(outputs[i], &error);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- error = tdm_output_hwc_destroy_window(outputs[i], hw);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- } else {
- ASSERT_EQ(NULL, tdm_output_hwc_create_window(outputs[i], &error));
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-
-
/* tdm_error tdm_output_hwc_destroy_window(tdm_output *output, tdm_hwc_window *hwc_window); */
TEST_F(TDMOutputHwc, DestroyWindowFailNull)
{
}
-/* tdm_error tdm_output_hwc_set_client_target_buffer(tdm_output *output,
- tbm_surface_h target_buffer, tdm_hwc_region damage,
- tdm_hwc_window *composited_wnds, uint32_t num_wnds); */
-/* TDOO: need to be fixed
-TEST_F(TDMOutputHwc, SetClientTargetBufferFailNullOutput)
-{
- tdm_hwc_region reg;
- tbm_surface_h target_buff = CreateBufferForOutput(0);
- error = tdm_output_hwc_set_client_target_buffer(NULL, target_buff, reg, NULL, 0 );
- tbm_surface_internal_destroy(target_buff);
- ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, SetClientTargetBufferFailNoHwc)
-{
- tdm_hwc_region damage = {.num_rects = 0, .rects = NULL};
-
- for (int i = 0; i < output_count; i++) {
- tbm_surface_h target_buff = CreateBufferForOutput(i);
- ASSERT_NE(NULL, target_buff);
- error = tdm_output_hwc_set_client_target_buffer(outputs[i], target_buff, damage, NULL, 0);
- tbm_surface_internal_destroy(target_buff);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-TEST_F(TDMOutputHwc, SetClientTargetBufferSuccessfulSetBuff)
-{
- tdm_hwc_region damage = {.num_rects = 0, .rects = NULL};
-
- for (int i = 0; i < output_count; i++) {
- tbm_surface_h target_buff = CreateBufferForOutput(i);
- ASSERT_NE(NULL, target_buff);
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_set_client_target_buffer(outputs[i], target_buff, damage,
- NULL, 0);
- tbm_surface_internal_destroy(target_buff);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- } else {
- error = tdm_output_hwc_set_client_target_buffer(outputs[i], target_buff, damage,
- NULL, 0);
- tbm_surface_internal_destroy(target_buff);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-
-TEST_F(TDMOutputHwc, SetClientTargetBufferSuccessfulResetBuff)
-{
- tdm_hwc_region damage = {.num_rects = 0, .rects = NULL};
-
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_set_client_target_buffer(outputs[i], NULL, damage,
- NULL, 0);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- } else {
- error = tdm_output_hwc_set_client_target_buffer(outputs[i], NULL, damage,
- NULL, 0);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-*/
-
-/* tbm_surface_queue_h tdm_output_hwc_get_target_buffer_queue(tdm_output *output, tdm_error *error); */
-TEST_F(TDMOutputHwc, GetTargetBufferQueueFailNullObject)
-{
- tbm_surface_queue_h queue = NULL;
-
- queue = tdm_output_hwc_get_target_buffer_queue(NULL, &error);
- ASSERT_NE(TDM_ERROR_NONE, error);
- ASSERT_EQ(NULL, queue);
-
- queue = tdm_output_hwc_get_target_buffer_queue(NULL, NULL);
- ASSERT_EQ(NULL, queue);
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, GetTargetBufferQueueFainNoHwc)
-{
- tbm_surface_queue_h queue = NULL;
-
- for (int i = 0; i < output_count; i++) {
- queue = tdm_output_hwc_get_target_buffer_queue(outputs[i], &error);
- ASSERT_NE(TDM_ERROR_NONE, error);
- ASSERT_EQ(NULL, queue);
- }
-}
-
-TEST_F(TDMOutputHwc, GetTargetBufferQueueSuccessful)
-{
- tbm_surface_queue_h queue = NULL;
-
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- queue = tdm_output_hwc_get_target_buffer_queue(outputs[i], &error);
- tbm_surface_queue_destroy(queue);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_NE(NULL, queue);
-
- queue = tdm_output_hwc_get_target_buffer_queue(outputs[i], NULL);
- tbm_surface_queue_destroy(queue);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_NE(NULL, queue);
- } else {
- queue = tdm_output_hwc_get_target_buffer_queue(outputs[i], &error);
- ASSERT_NE(TDM_ERROR_NONE, error);
- ASSERT_EQ(NULL, queue);
-
- queue = tdm_output_hwc_get_target_buffer_queue(outputs[i], NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
- ASSERT_EQ(NULL, queue);
- }
- }
-}
-
/* tbm_surface_queue_h tdm_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error); */
TEST_F(TDMHwcWindow, GetBufferQueueFailNull)
{
}
}
-/* tdm_error tdm_output_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_F(TDMOutputHwc, ValidateFailNull)
-{
- uint32_t num_types;
- error = tdm_output_hwc_validate(NULL, NULL, 0, &num_types);
- ASSERT_NE(TDM_ERROR_NONE, error);
-
- if (outputs[0]) {
- error = tdm_output_hwc_validate(outputs[0], NULL, 0, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, ValidateFailNoHwc)
-{
- uint32_t num_types;
-
- for (int i = 0; i < output_count; i++) {
- error = tdm_output_hwc_validate(outputs[i], &num_types);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-TEST_F(TDMOutputHwc, ValidateSuccessful)
-{
- uint32_t num_types;
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_validate(outputs[i], &num_types);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- } else {
- error = tdm_output_hwc_validate(outputs[i], &num_types);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-TODO: */
-
-/* tdm_error tdm_output_hwc_get_changed_composition_types(tdm_output *output,
- uint32_t *num_elements, tdm_hwc_window **hwc_window,
- tdm_hwc_window_composition *composition_types); */
-
-TEST_F(TDMOutputHwc, GetChangedCompositionTypesFailNull)
-{
- uint32_t num_elements;
-
- error = tdm_output_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
-
- if (outputs[0]) {
- error = tdm_output_hwc_get_changed_composition_types(outputs[0], NULL, NULL, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, GetChangedCompositionTypesFailNoHwc)
-{
- uint32_t get_num = 10;
-
- for (int i = 0; i < output_count; i++) {
- error = tdm_output_hwc_get_changed_composition_types(outputs[i], &get_num, NULL, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-/* TODO: fix the validate test later.
-TEST_F(TDMHwcWindow, GetChangedCompositionTypesSuccessful)
-{
- 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[i], TDM_COMPOSITION_DEVICE);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- }
-
-
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_validate(outputs[i], &validate_num);
- ASSERT_EQ(TDM_ERROR_NONE, error);
-
- error = tdm_output_hwc_get_changed_composition_types(outputs[i], &get_num, NULL, NULL);
- ASSERT_EQ(TDM_ERROR_NONE, error);
-
- ASSERT_TRUE(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_output_hwc_get_changed_composition_types(outputs[i], &get_num, hwc_wnds, composition_types);
-
- free(hwc_wnds);
- free(composition_types);
-
- ASSERT_EQ(TDM_ERROR_NONE, error);
- } else {
- error = tdm_output_hwc_get_changed_composition_types(outputs[i], &get_num, NULL, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-*/
-
-/* tdm_error tdm_output_hwc_accept_changes(tdm_output *output); */
-
-TEST_F(TDMOutputHwc, AcceptChangesFailNull)
-{
- error = tdm_output_hwc_accept_changes(NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, AcceptChangesFailNoHwc)
-{
- for (int i = 0; i < output_count; i++) {
- error = tdm_output_hwc_accept_changes(outputs[i]);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-/* TODO: fix the validate test later.
-TEST_F(TDMHwcWindow, AcceptChangesSuccessful)
-{
- uint32_t validate_num;
-
- for (int i = 0; i < hwc_count; i++) {
- error = tdm_hwc_window_set_composition_type(hwc_wins[i], TDM_COMPOSITION_DEVICE);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- }
-
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_validate(outputs[i], &validate_num);
- ASSERT_EQ(TDM_ERROR_NONE, error);
-
- if (validate_num > 0) {
- error = tdm_output_hwc_accept_changes(outputs[i]);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- }
- }
- }
-}
-*/
-
-static int need_validate_handler_is_called = 0;
-static void need_validate_handler(tdm_output *output)
-{
- need_validate_handler_is_called = 1;
-}
-/* tdm_error tdm_output_hwc_set_need_validate_handler(tdm_output *output,
- tdm_output_need_validate_handler hndl); */
-TEST_F(TDMOutputHwc, SetNeedValidateHandlerFailNull)
-{
- error = tdm_output_hwc_set_need_validate_handler(NULL, &need_validate_handler);
- ASSERT_NE(TDM_ERROR_NONE, error);
-
- error = tdm_output_hwc_set_need_validate_handler(outputs[0], NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
-
-}
-
-TEST_F(TDMOutputHwcWithoutHwcCap, SetNeedValidateHandlerFailNoHwc)
-{
- for (int i = 0; i < output_count; i++) {
- error = tdm_output_hwc_set_need_validate_handler(outputs[i], &need_validate_handler);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
-}
-
-TEST_F(TDMOutputHwc, SetNeedValidateHandlerSuccessful)
-{
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- /*
- * This event can't be generated form user side.
- * So just check a set and double set
- */
-
- /* test: first set*/
- error = tdm_output_hwc_set_need_validate_handler(outputs[i], &need_validate_handler);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- /* test: second isn't allowed*/
- error = tdm_output_hwc_set_need_validate_handler(outputs[i], &need_validate_handler);
- ASSERT_NE(TDM_ERROR_NONE, error);
- } else {
- error = tdm_output_hwc_set_need_validate_handler(outputs[i], &need_validate_handler);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-
-/* tdm_hwc_window * tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error); */
-TEST_F(TDMOutputHwc, CreateVideoWindowFailNull)
-{
- ASSERT_EQ(NULL, tdm_output_hwc_create_video_window(NULL, &error));
- ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_F(TDMOutputHwc, CreateVideoWindowSuccessful)
-{
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- tdm_hwc_window * hw = tdm_output_hwc_create_video_window(outputs[i], &error);
- if (error != TDM_ERROR_NOT_IMPLEMENTED) {
- ASSERT_EQ(TDM_ERROR_NONE, error);
- ASSERT_NE(NULL, hw);
- error = tdm_output_hwc_destroy_window(outputs[i], hw);
- ASSERT_EQ(TDM_ERROR_NONE, error);
- }
- } else {
- ASSERT_EQ(NULL, tdm_output_hwc_create_video_window(outputs[i], &error));
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
-
-/* tdm_output_hwc_get_video_supported_formats() */
-TEST_F(TDMOutputHwc, GetVideoSupportedFormatsFailNull)
-{
- tdm_error error;
-
- error = tdm_output_hwc_get_video_supported_formats(NULL, NULL, NULL);
- ASSERT_NE(TDM_ERROR_NONE, error);
-}
-
-TEST_F(TDMOutputHwc, GetVideoSupportedFormatsSuccessful)
-{
- tdm_error error;
- const tbm_format *formats;
- int count;
-
- for (int i = 0; i < output_count; i++) {
- if (IsHwcEnable(i)) {
- error = tdm_output_hwc_get_video_supported_formats(outputs[i], &formats, &count);
- if (error != TDM_ERROR_NOT_IMPLEMENTED) {
- ASSERT_EQ(TDM_ERROR_NONE, error);
- if (count > 0)
- ASSERT_NE(NULL, formats);
- }
- } else {
- error = tdm_output_hwc_get_video_supported_formats(outputs[i], &formats, &count);
- ASSERT_NE(TDM_ERROR_NONE, error);
- }
- }
-}
/* tdm_hwc_window_video_get_available_properties() */
TEST_F(TDMHwcWindow, GetAvailablePropertiesFailNullWin)
--- /dev/null
+/**************************************************************************
+ *
+ * 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 "ut_tdm.h"
+
+class TDMOutputHwc : public TDMOutput {
+public:
+ TDMOutputHwc();
+ void SetUp(void);
+ void TearDown(void);
+
+ tdm_error error;
+};
+
+TDMOutputHwc::TDMOutputHwc()
+{
+ ;
+}
+
+void TDMOutputHwc::SetUp(void)
+{
+ TDMOutput::SetUp();
+}
+
+void TDMOutputHwc::TearDown(void)
+{
+ TDMOutput::TearDown();
+}
+
+#ifdef UT_TDM_OUTPUT_HWC_ENABLE
+
+/* tdm_hwc_window * tdm_output_hwc_create_window(tdm_output *output, tdm_error *error); */
+TEST_P(TDMOutputHwc, CreateWindowFailNull)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ ASSERT_EQ(NULL, tdm_output_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ hw = tdm_output_hwc_create_window(outputs[o], &error);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ error = tdm_output_hwc_destroy_window(outputs[o], hw);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ } else {
+ ASSERT_EQ(NULL, tdm_output_hwc_create_window(outputs[o], &error));
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+
+/* tdm_error tdm_output_hwc_set_client_target_buffer(tdm_output *output,
+ tbm_surface_h target_buffer, tdm_hwc_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_hwc_region reg;
+ tbm_surface_h target_buff = CreateBufferForOutput(0);
+ error = tdm_output_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_hwc_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_output_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_hwc_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_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_output_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_hwc_region damage = {.num_rects = 0, .rects = NULL};
+
+ for (int o = 0; o < output_count; o++) {
+ if (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_hwc_set_client_target_buffer(outputs[o], NULL, damage,
+ NULL, 0);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ } else {
+ error = tdm_output_hwc_set_client_target_buffer(outputs[o], NULL, damage,
+ NULL, 0);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+*/
+
+/* tbm_surface_queue_h tdm_output_hwc_get_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_output_hwc_get_target_buffer_queue(NULL, &error);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ ASSERT_EQ(NULL, queue);
+
+ queue = tdm_output_hwc_get_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_output_hwc_get_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ queue = tdm_output_hwc_get_target_buffer_queue(outputs[o], &error);
+ tbm_surface_queue_destroy(queue);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ ASSERT_NE(NULL, queue);
+
+ queue = tdm_output_hwc_get_target_buffer_queue(outputs[o], NULL);
+ tbm_surface_queue_destroy(queue);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ ASSERT_NE(NULL, queue);
+ } else {
+ queue = tdm_output_hwc_get_target_buffer_queue(outputs[o], &error);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ ASSERT_EQ(NULL, queue);
+
+ queue = tdm_output_hwc_get_target_buffer_queue(outputs[o], NULL);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ ASSERT_EQ(NULL, queue);
+ }
+ }
+}
+
+/* tdm_error tdm_output_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_output_hwc_validate(NULL, NULL, 0, &num_types);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+
+ if (outputs[0]) {
+ error = tdm_output_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_output_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_hwc_validate(outputs[o], &num_types);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ } else {
+ error = tdm_output_hwc_validate(outputs[o], &num_types);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+TODO: */
+
+/* tdm_error tdm_output_hwc_get_changed_composition_types(tdm_output *output,
+ 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_output_hwc_get_changed_composition_types(NULL, &num_elements, NULL, NULL);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+
+ if (outputs[0]) {
+ error = tdm_output_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_output_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_hwc_validate(outputs[o], &validate_num);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+
+ error = tdm_output_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+
+ ASSERT_TRUE(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_output_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_output_hwc_get_changed_composition_types(outputs[o], &get_num, NULL, NULL);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+*/
+
+/* tdm_error tdm_output_hwc_accept_changes(tdm_output *output); */
+
+TEST_P(TDMOutputHwc, AcceptChangesFailNull)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ error = tdm_output_hwc_accept_changes(NULL);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMOutputHwc, AcceptChangesFailNoHwc)
+{
+ for (int o = 0; o < output_count; o++) {
+ error = tdm_output_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_hwc_validate(outputs[o], &validate_num);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+
+ if (validate_num > 0) {
+ error = tdm_output_hwc_accept_changes(outputs[o]);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ }
+ }
+ }
+}
+*/
+
+/* tdm_hwc_window * tdm_output_hwc_create_video_window(tdm_output *output, tdm_error *error); */
+TEST_P(TDMOutputHwc, CreateVideoWindowFailNull)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ ASSERT_EQ(NULL, tdm_output_hwc_create_video_window(NULL, &error));
+ ASSERT_NE(TDM_ERROR_NONE, error);
+}
+
+TEST_P(TDMOutputHwc, CreateVideoWindowSuccessful)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ tdm_hwc_window *hw = NULL;
+
+ for (int o = 0; o < output_count; o++) {
+ if (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ hw = tdm_output_hwc_create_video_window(outputs[o], &error);
+ if (error != TDM_ERROR_NOT_IMPLEMENTED) {
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ ASSERT_NE(NULL, hw);
+ error = tdm_output_hwc_destroy_window(outputs[o], hw);
+ ASSERT_EQ(TDM_ERROR_NONE, error);
+ }
+ } else {
+ ASSERT_EQ(NULL, tdm_output_hwc_create_video_window(outputs[o], &error));
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+
+/* tdm_output_hwc_get_video_supported_formats() */
+TEST_P(TDMOutputHwc, GetVideoSupportedFormatsFailNull)
+{
+ TDM_UT_SKIP_FLAG(has_outputs);
+
+ tdm_error error;
+
+ error = tdm_output_hwc_get_video_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 (ut_tdm_output_is_hwc_enable(outputs[o])) {
+ error = tdm_output_hwc_get_video_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_output_hwc_get_video_supported_formats(outputs[o], &formats, &count);
+ ASSERT_NE(TDM_ERROR_NONE, error);
+ }
+ }
+}
+
+INSTANTIATE_TEST_CASE_P(TDMOutputHwcParams,
+ TDMOutputHwc,
+ Combine(Bool(), Bool(), Values(TDM_DEFAULT_MODULE)));
+#endif