haltest/layer: Remove duplicate code 12/277512/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 4 Jul 2022 08:38:20 +0000 (17:38 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 7 Jul 2022 10:07:23 +0000 (19:07 +0900)
Change-Id: I94ae91b632c40f2e03ea24f7872fc55707c308b2

haltests/src/tc_tdm_layer.cpp

index 1e1aef6..68045a1 100644 (file)
@@ -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);