From 790d334f04dd00d23309140580cf82add7ce4f5a Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Wed, 7 Nov 2018 14:26:40 +0900 Subject: [PATCH 1/1] virtual: default unload virtual module Change-Id: Icffbeda1b9f004b4df3f1d58ced94dc2a3d2d38b Signed-off-by: Junkyeong Kim --- haltests/src/tc_tdm_client.cpp | 94 ++++++++++++++++++++++++++++++++++++++++++ src/tdm.c | 12 ++++-- src/tdm_config.h | 6 +++ 3 files changed, 108 insertions(+), 4 deletions(-) diff --git a/haltests/src/tc_tdm_client.cpp b/haltests/src/tc_tdm_client.cpp index 504aaee..282d8ab 100644 --- a/haltests/src/tc_tdm_client.cpp +++ b/haltests/src/tc_tdm_client.cpp @@ -1419,8 +1419,15 @@ TEST_P(TDMClient, ClientVblankIsWaitingNullObject) TEST_P(TDMClient, ClientCreateVOutput) { tdm_error ret; + int virtual_conf = 0; const char name[TDM_NAME_LEN] = "Virtual Output"; + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + if (virtual_conf == 0) { + ASSERT_EQ(virtual_conf, 0); + return; + } + ASSERT_EQ(PrepareClient(), true); voutput = tdm_client_create_voutput(client, name, &ret); @@ -1531,8 +1538,12 @@ void TDMVirtualOutput::TearDownTestCase(void) bool TDMVirtualOutput::PrepareVOutput(void) { tdm_error ret; + int virtual_conf = 0; const char name[TDM_NAME_LEN] = "Virtual Output"; + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + if (virtual_conf == 0) return true; + client = tdm_client_create(&ret); TDM_UT_RETURN_FALSE_IF_FAIL(ret == TDM_ERROR_NONE); TDM_UT_RETURN_FALSE_IF_FAIL(client != NULL); @@ -1575,7 +1586,13 @@ TEST_F(TDMVirtualOutput, SetAvailableModes) tdm_error ret; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } _tc_tdm_client_virutual_make_available_mode(modes, count); ret = tdm_client_voutput_set_available_modes(this->voutput, modes, count); @@ -1587,6 +1604,13 @@ TEST_F(TDMVirtualOutput, FailTestSetAvailableModes) tdm_error ret; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_available_modes(NULL, modes, count); ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER); @@ -1599,6 +1623,13 @@ TEST_F(TDMVirtualOutput, SetPhysicalSize) { tdm_error ret; unsigned int mmWidth = 1234, mmHeight = 1234; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1608,6 +1639,13 @@ TEST_F(TDMVirtualOutput, FailTestSetPhysicalSize) { tdm_error ret; unsigned int invalid_mmWidth = 0, invalid_mmHeight = 0; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, invalid_mmWidth, invalid_mmHeight); ASSERT_EQ(ret, TDM_ERROR_INVALID_PARAMETER); @@ -1625,6 +1663,13 @@ TEST_F(TDMVirtualOutput, AddCommitHandler) { tdm_error ret; int flag_callback_called = 0; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_add_commit_handler(this->voutput, _tc_tdm_client_voutput_commit_handler, @@ -1640,6 +1685,13 @@ TEST_F(TDMVirtualOutput, AddCommitHandler) TEST_F(TDMVirtualOutput, CommitDone) { tdm_error ret; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_commit_done(this->voutput); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1649,6 +1701,13 @@ TEST_F(TDMVirtualOutput, GetClientOutput) { tdm_error ret; tdm_client_output *output; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } output = tdm_client_voutput_get_client_output(this->voutput, &ret); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1661,6 +1720,13 @@ TEST_F(TDMVirtualOutput, Connect) unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1678,6 +1744,13 @@ TEST_F(TDMVirtualOutput, Connect) TEST_F(TDMVirtualOutput, Disconnect) { tdm_error ret; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } // TDM_UT_WAIT("check & press"); @@ -1694,6 +1767,13 @@ TEST_F(TDMVirtualOutput, SetMode) unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1723,6 +1803,13 @@ TEST_F(TDMVirtualOutput, SetModeNullObject) unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); @@ -1750,6 +1837,13 @@ TEST_F(TDMVirtualOutput, SetModeInvalidIndex) unsigned int mmWidth = 300, mmHeight = 150; tdm_client_output_mode modes[this->MODE_COUNT]; int count = this->MODE_COUNT; + int virtual_conf; + + if (this->voutput == NULL) { + virtual_conf = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + ASSERT_EQ(virtual_conf, 0); + return; + } ret = tdm_client_voutput_set_physical_size(this->voutput, mmWidth, mmHeight); ASSERT_EQ(ret, TDM_ERROR_NONE); diff --git a/src/tdm.c b/src/tdm.c index e6866cc..6208859 100644 --- a/src/tdm.c +++ b/src/tdm.c @@ -759,6 +759,7 @@ _tdm_display_setup(tdm_private_display *private_display) tdm_private_module *private_module = NULL; tdm_error ret = TDM_ERROR_NONE; int output_count = 0; + int virtual = 0; if (private_display->pp_module) { ret = _tdm_display_update_caps_pp(private_display->pp_module, @@ -818,10 +819,13 @@ _tdm_display_setup(tdm_private_display *private_display) } } - TDM_INFO("loading a %s backend", TDM_VIRTUAL_MODULE); - ret = _tdm_display_load_module_with_file(private_display, TDM_VIRTUAL_MODULE); - TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed_update); - TDM_GOTO_IF_FAIL(private_display->virtual_module != NULL, failed_update); + virtual = tdm_config_get_int(TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT, 0); + if (virtual) { + TDM_INFO("loading a %s backend", TDM_VIRTUAL_MODULE); + ret = _tdm_display_load_module_with_file(private_display, TDM_VIRTUAL_MODULE); + TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, failed_update); + TDM_GOTO_IF_FAIL(private_display->virtual_module != NULL, failed_update); + } return TDM_ERROR_NONE; diff --git a/src/tdm_config.h b/src/tdm_config.h index 73eeb9f..a9ed0fd 100644 --- a/src/tdm_config.h +++ b/src/tdm_config.h @@ -114,6 +114,12 @@ tdm_config_set_string(const char *key, const char *value); */ #define TDM_CONFIG_KEY_GENERAL_COMMIT_PER_VBLANK "general:commit_per_vblank" +/* enable the tdm virtual output module. [0(disable), 1(enable)] + * default: 0 + * ex) 1 + */ +#define TDM_CONFIG_KEY_GENERAL_VIRTUAL_OUTPUT "general:virtual_output" + /*** debug keys **************************************************************/ -- 2.7.4