From 1a815398d29963913549f5ec0e09268c39dff9e9 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 4 Jul 2022 17:38:20 +0900 Subject: [PATCH] haltest/layer: Remove duplicate code Change-Id: I94ae91b632c40f2e03ea24f7872fc55707c308b2 --- haltests/src/tc_tdm_layer.cpp | 42 +++++++----------------------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/haltests/src/tc_tdm_layer.cpp b/haltests/src/tc_tdm_layer.cpp index 1e1aef6..68045a1 100644 --- a/haltests/src/tc_tdm_layer.cpp +++ b/haltests/src/tc_tdm_layer.cpp @@ -356,36 +356,7 @@ tc_tdm_layer_fill_info(tdm_layer *layer, tbm_surface_h buffer, tbm_surface_queue bool tc_tdm_layer_set_buffer(tdm_layer *layer, tbm_surface_h buffer) { - tdm_info_layer old_info, info; - - TDM_UT_RETURN_FALSE_IF_FAIL(buffer != NULL); - - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_info(layer, &old_info) == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_layer_fill_info(layer, buffer, NULL, &info) == true); - - if (memcmp(&old_info, &info, sizeof info)) { - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_set_info(layer, &info) == TDM_ERROR_NONE); - - tdm_output *output; - tdm_error ret; - int index = -1; - unsigned int pipe = 0; - output = tdm_layer_get_output(layer, &ret); - TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_index(layer, &index) == TDM_ERROR_NONE); - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_pipe(output, &pipe) == TDM_ERROR_NONE); - TDM_INFO("filling output(%d) layer(%d) info done: src_config(%dx%d: %d,%d %dx%d: %c%c%c%c) dst_pos(%d,%d %dx%d) transform(%s)", - pipe, index, - info.src_config.size.h, info.src_config.size.v, - info.src_config.pos.x, info.src_config.pos.y, info.src_config.pos.w, info.src_config.pos.h, - FOURCC_STR(info.src_config.format), - info.dst_pos.x, info.dst_pos.y, info.dst_pos.w, info.dst_pos.h, - tdm_transform_str(info.transform)); - } - - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_set_buffer(layer, buffer) == TDM_ERROR_NONE); - - return true; + return tc_tdm_layer_set_buffer_with_pos(layer, buffer, NULL); } bool tc_tdm_layer_set_buffer_with_pos(tdm_layer *layer, tbm_surface_h buffer, tdm_pos *pos) @@ -393,15 +364,16 @@ bool tc_tdm_layer_set_buffer_with_pos(tdm_layer *layer, tbm_surface_h buffer, td tdm_info_layer old_info, info; TDM_UT_RETURN_FALSE_IF_FAIL(buffer != NULL); - TDM_UT_RETURN_FALSE_IF_FAIL(pos != NULL); TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_get_info(layer, &old_info) == TDM_ERROR_NONE); TDM_UT_RETURN_FALSE_IF_FAIL(tc_tdm_layer_fill_info(layer, buffer, NULL, &info) == true); - info.dst_pos.x = pos->x; - info.dst_pos.y = pos->y; - TDM_UT_RETURN_FALSE_IF_FAIL(info.dst_pos.w = pos->w); - TDM_UT_RETURN_FALSE_IF_FAIL(info.dst_pos.h = pos->h); + if (pos) { + info.dst_pos.x = pos->x; + info.dst_pos.y = pos->y; + TDM_UT_RETURN_FALSE_IF_FAIL(info.dst_pos.w = pos->w); + TDM_UT_RETURN_FALSE_IF_FAIL(info.dst_pos.h = pos->h); + } if (memcmp(&old_info, &info, sizeof info)) { TDM_UT_RETURN_FALSE_IF_FAIL(tdm_layer_set_info(layer, &info) == TDM_ERROR_NONE); -- 2.7.4