From 036d2dbb5e236625a31b38af094fa1ecfe7225a6 Mon Sep 17 00:00:00 2001 From: Boram Park Date: Wed, 14 Mar 2018 16:49:41 +0900 Subject: [PATCH] utests: correct wrong behavior Change-Id: I636ded1f8e084f626f42f3197847d9b445c9678d --- utests/src/ut_tdm_backend_display.cpp | 16 +++- utests/src/ut_tdm_backend_pp.cpp | 7 +- utests/src/ut_tdm_buffer.cpp | 6 +- utests/src/ut_tdm_client.cpp | 167 +++++++++++++++++++++------------- utests/src/ut_tdm_env.cpp | 2 +- utests/src/ut_tdm_layer.cpp | 10 +- utests/src/ut_tdm_output.cpp | 4 + 7 files changed, 136 insertions(+), 76 deletions(-) diff --git a/utests/src/ut_tdm_backend_display.cpp b/utests/src/ut_tdm_backend_display.cpp index b69ef32..7fc69a4 100644 --- a/utests/src/ut_tdm_backend_display.cpp +++ b/utests/src/ut_tdm_backend_display.cpp @@ -895,6 +895,8 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerFormat) ASSERT_EQ(tdm_output_get_pipe(output, &pipe), TDM_ERROR_NONE); + TDM_UT_INFO("* testing for (output: %d, layer: %d)", pipe, l); + ASSERT_EQ(tdm_layer_get_buffer_flags(layer, &flags), TDM_ERROR_NONE); ASSERT_EQ(tdm_output_get_mode(output, &mode), TDM_ERROR_NONE); ASSERT_NE(mode, NULL); @@ -905,7 +907,7 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerFormat) for (int f = 0; f < format_count; f++) { retry: - TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); + TDM_UT_INFO("** testing for %c%c%c%c", FOURCC_STR(formats[f])); ASSERT_EQ(ut_tdm_buffer_create(mode->hdisplay, mode->vdisplay, formats[f], flags | TBM_BO_SCANOUT, true, 3, buffers), true); /* set buffer & commit for TDM_UT_BACKEND_TEST_CNT times */ @@ -963,6 +965,8 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerSize) ASSERT_EQ(tdm_output_get_pipe(output, &pipe), TDM_ERROR_NONE); + TDM_UT_INFO("* testing for (output: %d, layer: %d)", pipe, l); + ASSERT_EQ(tdm_layer_get_buffer_flags(layer, &flags), TDM_ERROR_NONE); ASSERT_EQ(tdm_output_get_mode(output, &mode), TDM_ERROR_NONE); ASSERT_NE(mode, NULL); @@ -977,7 +981,7 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerSize) int w = mode->hdisplay - diffw * (f + 1); int h = mode->vdisplay - diffh * (f + 1); retry: - TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); + TDM_UT_INFO("** testing for %c%c%c%c", FOURCC_STR(formats[f])); ASSERT_EQ(ut_tdm_buffer_create(w, h, formats[f], flags | TBM_BO_SCANOUT, true, 3, buffers), true); /* set buffer & commit for TDM_UT_BACKEND_TEST_CNT times */ @@ -1125,6 +1129,8 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerMovePosition) ASSERT_EQ(tdm_output_get_pipe(output, &pipe), TDM_ERROR_NONE); + TDM_UT_INFO("* testing for (output: %d, layer: %d)", pipe, l); + ASSERT_EQ(tdm_layer_get_buffer_flags(layer, &flags), TDM_ERROR_NONE); ASSERT_EQ(tdm_output_get_mode(output, &mode), TDM_ERROR_NONE); ASSERT_NE(mode, NULL); @@ -1135,7 +1141,7 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerMovePosition) for (int f = 0; f < format_count; f++) { retry: - TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); + TDM_UT_INFO("** testing for %c%c%c%c", FOURCC_STR(formats[f])); ASSERT_EQ(ut_tdm_buffer_create(TDM_UT_BUFFER_SIZE, TDM_UT_BUFFER_SIZE, formats[f], flags | TBM_BO_SCANOUT, true, 3, buffers), true); /* set buffer & commit for TDM_UT_BACKEND_TEST_CNT times */ @@ -1215,6 +1221,8 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerCrop) continue; } + TDM_UT_INFO("* testing for (output: %d, layer: %d)", pipe, l); + ASSERT_EQ(tdm_layer_get_buffer_flags(layer, &flags), TDM_ERROR_NONE); ASSERT_EQ(tdm_output_get_mode(output, &mode), TDM_ERROR_NONE); ASSERT_NE(mode, NULL); @@ -1225,7 +1233,7 @@ TEST_P(TDMBackendDisplay, VerifyOverlayLayerCrop) for (int f = 0; f < format_count; f++) { retry: - TDM_UT_INFO("* testing for %c%c%c%c", FOURCC_STR(formats[f])); + TDM_UT_INFO("** testing for %c%c%c%c", FOURCC_STR(formats[f])); ASSERT_EQ(ut_tdm_buffer_create(mode->hdisplay, mode->vdisplay, formats[f], flags | TBM_BO_SCANOUT, true, 3, buffers), true); tdm_info_layer info; diff --git a/utests/src/ut_tdm_backend_pp.cpp b/utests/src/ut_tdm_backend_pp.cpp index b326f4a..049f4ad 100644 --- a/utests/src/ut_tdm_backend_pp.cpp +++ b/utests/src/ut_tdm_backend_pp.cpp @@ -76,6 +76,9 @@ void TDMBackendPP::SetUp(void) { TDMBackendDisplay::SetUp(); + if (!ut_tdm_display_has_pp_capability(dpy)) + return; + ASSERT_EQ(tdm_display_get_pp_capabilities(dpy, &capabilities), TDM_ERROR_NONE); ASSERT_GT(capabilities, 0); ASSERT_EQ(tdm_display_get_pp_available_formats(dpy, &formats, &format_count), TDM_ERROR_NONE); @@ -218,7 +221,7 @@ TEST_P(TDMBackendPP, PPDispalyGetAvaiableFormatsNullObject) if (ut_tdm_display_has_pp_capability(dpy)) ASSERT_EQ(tdm_display_get_pp_available_formats(NULL, &formats, &count), TDM_ERROR_INVALID_PARAMETER); else - ASSERT_EQ(tdm_display_get_pp_available_formats(NULL, &formats, &count), TDM_ERROR_NO_CAPABILITY); + ASSERT_EQ(tdm_display_get_pp_available_formats(NULL, &formats, &count), TDM_ERROR_INVALID_PARAMETER); ASSERT_EQ(formats, (const tbm_format *)TDM_UT_INVALID_VALUE); ASSERT_EQ(count, TDM_UT_INVALID_VALUE); } @@ -241,7 +244,7 @@ TEST_P(TDMBackendPP, PPDispalyGetAvaiableSizeNullObject) if (ut_tdm_display_has_pp_capability(dpy)) ASSERT_EQ(tdm_display_get_pp_available_size(NULL, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_INVALID_PARAMETER); else - ASSERT_EQ(tdm_display_get_pp_available_size(NULL, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_NO_CAPABILITY); + ASSERT_EQ(tdm_display_get_pp_available_size(NULL, &min_w, &min_h, &max_w, &max_h, &preferred_align), TDM_ERROR_INVALID_PARAMETER); ASSERT_EQ(min_w, TDM_UT_INVALID_VALUE); ASSERT_EQ(min_h, TDM_UT_INVALID_VALUE); ASSERT_EQ(max_w, TDM_UT_INVALID_VALUE); diff --git a/utests/src/ut_tdm_buffer.cpp b/utests/src/ut_tdm_buffer.cpp index 3443176..10ec508 100644 --- a/utests/src/ut_tdm_buffer.cpp +++ b/utests/src/ut_tdm_buffer.cpp @@ -72,10 +72,10 @@ ut_tdm_buffer_create(int width, int height, tbm_format format, int flags, bool f TDM_UT_GOTO_IF_FAIL(buffers[b] != NULL, failed); if (fill) tdm_test_buffer_fill(buffers[b], PATTERN_SMPTE); - } - TDM_INFO("creating buffers done: width(%d) height(%d), format(%c%c%c%c) flags(%x) fill(%d), count(%d)", - width, height, FOURCC_STR(format), flags, fill, count); + TDM_INFO("creating buffer(%p) done: width(%d) height(%d), format(%c%c%c%c) flags(%x) fill(%d), count(%d)", + buffers[b], width, height, FOURCC_STR(format), flags, fill, count); + } return true; failed: diff --git a/utests/src/ut_tdm_client.cpp b/utests/src/ut_tdm_client.cpp index 055dbc3..858bc28 100644 --- a/utests/src/ut_tdm_client.cpp +++ b/utests/src/ut_tdm_client.cpp @@ -42,6 +42,7 @@ enum { TDM_UT_PIPE_MSG_NONE, TDM_UT_PIPE_MSG_REPLY, TDM_UT_PIPE_MSG_SERVER_READY, + TDM_UT_PIPE_MSG_SERVER_FAILED, TDM_UT_PIPE_MSG_DPMS_ON, TDM_UT_PIPE_MSG_DPMS_OFF, TDM_UT_PIPE_MSG_TERMINATE_SERVER, @@ -138,8 +139,6 @@ void TDMClient::SetUp(void) void TDMClient::TearDown(void) { - ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_ON), true); - if (vblank) tdm_client_vblank_destroy(vblank); if (client) @@ -226,17 +225,22 @@ _ut_tdm_server_set_output_dpms(tdm_display *dpy, int msg) { tdm_error ret; tdm_output *output; + tdm_output_dpms dpms; output = tdm_display_find_output(dpy, "primary", &ret); TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); TDM_UT_RETURN_FALSE_IF_FAIL(output != NULL); + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_get_dpms(output, &dpms) == TDM_ERROR_NONE); + switch (msg) { case TDM_UT_PIPE_MSG_DPMS_ON: - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON) == TDM_ERROR_NONE); + if (dpms != TDM_OUTPUT_DPMS_ON) + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_ON) == TDM_ERROR_NONE); break; case TDM_UT_PIPE_MSG_DPMS_OFF: - TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_OFF) == TDM_ERROR_NONE); + if (dpms != TDM_OUTPUT_DPMS_OFF) + TDM_UT_RETURN_FALSE_IF_FAIL(tdm_output_set_dpms(output, TDM_OUTPUT_DPMS_OFF) == TDM_ERROR_NONE); break; default: break; @@ -255,20 +259,20 @@ _ut_tdm_server_run(int *pipe_parent, int *pipe_child) int output_count = 0; dpy = tdm_display_init(&ret); - TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, done); - TDM_UT_GOTO_IF_FAIL(dpy != NULL, done); + TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed); + TDM_UT_GOTO_IF_FAIL(dpy != NULL, failed); - TDM_UT_GOTO_IF_FAIL(tdm_display_get_output_count(dpy, &output_count) == TDM_ERROR_NONE, done); + TDM_UT_GOTO_IF_FAIL(tdm_display_get_output_count(dpy, &output_count) == TDM_ERROR_NONE, failed); for (int o = 0; o < output_count; o++) { tdm_output *output = tdm_display_get_output(dpy, o, &ret); - TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, done); - TDM_UT_GOTO_IF_FAIL(output != NULL, done); + TDM_UT_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed); + TDM_UT_GOTO_IF_FAIL(output != NULL, failed); if (!ut_tdm_output_is_connected(output)) continue; - TDM_UT_GOTO_IF_FAIL(ut_tdm_output_prepare(dpy, output, true) == true, done); + TDM_UT_GOTO_IF_FAIL(ut_tdm_output_prepare(dpy, output, true) == true, failed); } TDM_UT_GOTO_IF_FAIL(_ut_tdm_pipe_write_msg(pipe_parent[1], -1, TDM_UT_PIPE_MSG_SERVER_READY) == true, done); @@ -323,6 +327,23 @@ _ut_tdm_server_run(int *pipe_parent, int *pipe_child) done: if (dpy) tdm_display_deinit(dpy); + return; + +failed: + TDM_UT_GOTO_IF_FAIL(_ut_tdm_pipe_write_msg(pipe_parent[1], -1, TDM_UT_PIPE_MSG_SERVER_FAILED) == true, done); + TDM_INFO("*** server failed ***"); + + if (dpy) + tdm_display_deinit(dpy); + return; + +} + +static void _ut_tdm_client_sig_handler(int sig) +{ + TDM_UT_ERR("got signal: %d", sig); + kill(TDMClient::server_pid, 9); + abort(); } static pid_t @@ -335,6 +356,8 @@ _ut_tdm_client_server_fork(int *pipe_parent, int *pipe_child) TDM_UT_GOTO_IF_FAIL(pipe(pipe_child) == 0, failed); signal(SIGCHLD, SIG_IGN); + signal(SIGSEGV, _ut_tdm_client_sig_handler); + prctl(PR_SET_PDEATHSIG, SIGHUP); pid = fork(); @@ -554,6 +577,10 @@ TEST_P(TDMClient, ClientOutputAddChangeHandler) ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); ASSERT_EQ(dpms, TDM_OUTPUT_DPMS_OFF); + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_ON), true); + while (dpms != TDM_OUTPUT_DPMS_ON) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); } TEST_P(TDMClient, ClientOutputAddChangeHandlerTwice) @@ -628,6 +655,10 @@ TEST_P(TDMClient, ClientOutputRemoveChangeHandlerInHandler) ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE); ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); } + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_ON), true); + while (dpms != TDM_OUTPUT_DPMS_ON) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); } TEST_P(TDMClient, ClientOutputRemoveChangeHandlerNullObject) @@ -1057,60 +1088,6 @@ TEST_P(TDMClient, ClientVblankWaitSeqInterval) } } -TEST_P(TDMClient, ClientVblankWaitNullObject) -{ - unsigned int cur_seq = 0; - - ASSERT_EQ(tdm_client_vblank_wait(NULL, 1, _ut_tdm_client_vblank_cb3, &cur_seq), TDM_ERROR_INVALID_PARAMETER); -} - -TEST_P(TDMClient, ClientVblankWaitNullOther) -{ - ASSERT_EQ(PrepareClient(), true); - ASSERT_EQ(PrepareOutput(), true); - ASSERT_EQ(PrepareVblank(), true); - - ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, NULL, NULL), TDM_ERROR_INVALID_PARAMETER); -} - -TEST_P(TDMClient, ClientVblankWaitDpmsOff) -{ - tdm_output_dpms dpms = (tdm_output_dpms)TDM_UT_INVALID_VALUE; - - ASSERT_EQ(PrepareClient(), true); - ASSERT_EQ(PrepareOutput(), true); - ASSERT_EQ(PrepareVblank(), true); - - ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_OFF), true); - while (dpms != TDM_OUTPUT_DPMS_OFF) - ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); - ASSERT_EQ(dpms, TDM_OUTPUT_DPMS_OFF); - - ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, NULL), TDM_ERROR_DPMS_OFF); -} - -TEST_P(TDMClient, ClientVblankWaitSetEnableFakeDpmsOff) -{ - tdm_output_dpms dpms = (tdm_output_dpms)TDM_UT_INVALID_VALUE; - bool done; - - ASSERT_EQ(PrepareClient(), true); - ASSERT_EQ(PrepareOutput(), true); - ASSERT_EQ(PrepareVblank(), true); - - ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_OFF), true); - while (dpms != TDM_OUTPUT_DPMS_OFF) - ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); - - ASSERT_EQ(tdm_client_vblank_set_enable_fake(vblank, 1), TDM_ERROR_NONE); - - done = false; - ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, &done), TDM_ERROR_NONE); - - while (!done) - ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE); -} - TEST_P(TDMClient, ClientVblankWaitSetOffset) { bool done; @@ -1267,6 +1244,68 @@ TEST_P(TDMVblank, VblankWaitIgnoreGlobalFps) #endif +TEST_P(TDMClient, ClientVblankWaitNullObject) +{ + unsigned int cur_seq = 0; + + ASSERT_EQ(tdm_client_vblank_wait(NULL, 1, _ut_tdm_client_vblank_cb3, &cur_seq), TDM_ERROR_INVALID_PARAMETER); +} + +TEST_P(TDMClient, ClientVblankWaitNullOther) +{ + ASSERT_EQ(PrepareClient(), true); + ASSERT_EQ(PrepareOutput(), true); + ASSERT_EQ(PrepareVblank(), true); + + ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, NULL, NULL), TDM_ERROR_INVALID_PARAMETER); +} + +TEST_P(TDMClient, ClientVblankWaitDpmsOff) +{ + tdm_output_dpms dpms = (tdm_output_dpms)TDM_UT_INVALID_VALUE; + + ASSERT_EQ(PrepareClient(), true); + ASSERT_EQ(PrepareOutput(), true); + ASSERT_EQ(PrepareVblank(), true); + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_OFF), true); + while (dpms != TDM_OUTPUT_DPMS_OFF) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); + ASSERT_EQ(dpms, TDM_OUTPUT_DPMS_OFF); + + ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, NULL), TDM_ERROR_DPMS_OFF); + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_ON), true); + while (dpms != TDM_OUTPUT_DPMS_ON) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); +} + +TEST_P(TDMClient, ClientVblankWaitSetEnableFakeDpmsOff) +{ + tdm_output_dpms dpms = (tdm_output_dpms)TDM_UT_INVALID_VALUE; + bool done; + + ASSERT_EQ(PrepareClient(), true); + ASSERT_EQ(PrepareOutput(), true); + ASSERT_EQ(PrepareVblank(), true); + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_OFF), true); + while (dpms != TDM_OUTPUT_DPMS_OFF) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); + + ASSERT_EQ(tdm_client_vblank_set_enable_fake(vblank, 1), TDM_ERROR_NONE); + + done = false; + ASSERT_EQ(tdm_client_vblank_wait(vblank, 1, _ut_tdm_client_vblank_cb2, &done), TDM_ERROR_NONE); + + while (!done) + ASSERT_EQ(tdm_client_handle_events_timeout(client, 3000), TDM_ERROR_NONE); + + ASSERT_EQ(_ut_tdm_pipe_write_msg(pipe_child[1], pipe_parent[0], TDM_UT_PIPE_MSG_DPMS_ON), true); + while (dpms != TDM_OUTPUT_DPMS_ON) + ASSERT_EQ(tdm_client_output_get_dpms(output, &dpms), TDM_ERROR_NONE); +} + #ifdef TDM_UT_TEST_WITH_PARAMS INSTANTIATE_TEST_CASE_P(TDMClientParams, TDMClient, diff --git a/utests/src/ut_tdm_env.cpp b/utests/src/ut_tdm_env.cpp index 217c0bf..a590b68 100644 --- a/utests/src/ut_tdm_env.cpp +++ b/utests/src/ut_tdm_env.cpp @@ -61,7 +61,7 @@ void TDMEnv::SetUp(void) const char *debug = getenv("TDM_UT_DEBUG_MODULE"); if (debug && strstr(debug, "1")) - tdm_config_set_string(TDM_CONFIG_KEY_DEBUG_MODULE, "buffer,thread,event,vblank,commit,pp,capture"); + tdm_config_set_string(TDM_CONFIG_KEY_DEBUG_MODULE, "buffer,vblank,commit,pp,capture"); } void TDMEnv::TearDown(void) diff --git a/utests/src/ut_tdm_layer.cpp b/utests/src/ut_tdm_layer.cpp index 7c3b143..4d97221 100644 --- a/utests/src/ut_tdm_layer.cpp +++ b/utests/src/ut_tdm_layer.cpp @@ -30,6 +30,8 @@ #include "ut_tdm.h" +#define BORDER_SIZE 20 + class TDMLayer : public TDMOutput { public: @@ -323,8 +325,12 @@ ut_tdm_layer_fill_info(tdm_layer *layer, int w, int h, tbm_format format, tdm_in info->dst_pos.x = 0; info->dst_pos.y = 0; } else { - info->dst_pos.x = ((mode->hdisplay - w) / count) * (zpos + 1); - info->dst_pos.y = ((mode->vdisplay - h) / count) * (zpos + 1); + int x = (((int)mode->hdisplay - 2 * BORDER_SIZE - w) / count) * zpos + BORDER_SIZE; + int y = (((int)mode->vdisplay - 2 * BORDER_SIZE - h) / count) * zpos + BORDER_SIZE; + x = (x > 0) ? x : 0; + y = (y > 0) ? y : 0; + info->dst_pos.x = ((x + w) <= (int)mode->hdisplay) ? x : 0; + info->dst_pos.y = ((y + h) <= (int)mode->vdisplay) ? y : 0; } info->dst_pos.w = w; info->dst_pos.h = h; diff --git a/utests/src/ut_tdm_output.cpp b/utests/src/ut_tdm_output.cpp index b038f81..479224c 100644 --- a/utests/src/ut_tdm_output.cpp +++ b/utests/src/ut_tdm_output.cpp @@ -187,6 +187,7 @@ ut_tdm_output_prepare(tdm_display *dpy, tdm_output *output, bool fill) tdm_info_layer info; tdm_layer *layer; bool done = false; + tdm_output_conn_status status; TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_output_is_connected(output) == true); TDM_UT_RETURN_FALSE_IF_FAIL(ut_tdm_output_mode_setting(output) == true); @@ -215,6 +216,9 @@ ut_tdm_output_prepare(tdm_display *dpy, tdm_output *output, bool fill) 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); + while (!done) { TDM_UT_GOTO_IF_FAIL(tdm_output_wait_vblank(output, 1, 0, _ut_tdm_output_done_cb, &done) == TDM_ERROR_NONE, failed); TDM_UT_GOTO_IF_FAIL(ut_tdm_display_handle_events(dpy) == TDM_ERROR_NONE, failed); -- 2.7.4