display: Add support of loading display conf file from /etc/deviced/conf.d/ 86/319086/5 accepted/tizen_unified_toolchain accepted/tizen/9.0/unified/20241030.233659 accepted/tizen/unified/20241017.114737 accepted/tizen/unified/toolchain/20241022.122642 accepted/tizen/unified/toolchain/20241022.123047 accepted/tizen/unified/x/20241017.170408 accepted/tizen/unified/x/asan/20241022.113547 tizen_9.0_m2_release
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 15 Oct 2024 02:03:34 +0000 (11:03 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 15 Oct 2024 09:51:59 +0000 (18:51 +0900)
Before this, display.conf file was used only default config file from deviced.
However, display conf file should be handled according to plugin backend profile.
With this, display.conf /etc/deviced/conf.d/ can be loaded.
To use display.conf defined from plugin backend, this is necessary.

Also, as applying this, to test and check dpms type in headless image,
new test case is added.

Change-Id: I030ec8e77ea50e9082e26231d7cf7549fdac7466
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/display/display-config.c
src/display/display-config.h
tests/syscommon-plugin-test/display.cc

index 7598686837fce77537a0a01da916abaed07b4379..212157e3a101b733c4d112804778df3f6e89d422 100644 (file)
@@ -124,6 +124,9 @@ int display_load_config(void)
                        return -ENOMEM;
        }
 
+       if (access(PLUGIN_DISPLAY_CONF_FILE, F_OK) == 0)
+               return config_parse(PLUGIN_DISPLAY_CONF_FILE, display_config_parse, g_display_config);
+
        return config_parse(DISPLAY_CONF_FILE, display_config_parse, g_display_config);
 }
 
index e71a1ac6bc7c55f4be995952467aad1f19b0e29a..54a3df4f7c2deafbb32bb41420bb21ac78ce22f1 100644 (file)
@@ -23,6 +23,7 @@
 #include <system/syscommon-plugin-deviced-display-interface.h>
 
 #define DISPLAY_CONF_FILE      "/etc/deviced/display.conf"
+#define PLUGIN_DISPLAY_CONF_FILE       "/etc/deviced/conf.d/display.conf"
 
 /**
  * FIXME: Add getters for all member variables not to expose it with extern keyword
index a7363ef7793ebad790671a2298704e8941ae72b8..3ace7f0c0bd4adabc0b73967b151e2fe047ef569 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "syscommon-plugin-test.h"
 
+#define DISPLAY_FEATURE        "http://tizen.org/feature/display"
+
 class DisplayTest : public testing::Test {
        protected:
                void SetUp() override {
@@ -13,10 +15,15 @@ class DisplayTest : public testing::Test {
                                display_plugin_backend_supported = true;
                        else
                                display_plugin_backend_supported = false;
+
+                       ret_val = system_info_get_platform_bool(DISPLAY_FEATURE, &display_feature);
+                       if (ret_val < 0)
+                               display_feature = false;
                }
                ~DisplayTest() {}
                void TearDown() override {}
                bool display_plugin_backend_supported;
+               bool display_feature;
 };
 
 TEST_F(DisplayTest, LoadConfig)
@@ -30,3 +37,21 @@ TEST_F(DisplayTest, LoadConfig)
        ret_val = syscommon_plugin_deviced_display_load_config(&display_config);
        EXPECT_TRUE(ret_val == 0 || ret_val == -ENOTSUP || ret_val == -EOPNOTSUPP);
 }
+
+TEST_F(DisplayTest, CheckDisplayDPMSTypeInHeadless)
+{
+       int ret_val = -1;
+       struct syscommon_deviced_display_config *display_config = NULL;
+
+       if (!display_plugin_backend_supported)
+               return;
+
+       if (display_feature) {
+               DEBUG_MESSAGE("This image is not headless image, display feature is true.");
+               return;
+       }
+
+       ret_val = syscommon_plugin_deviced_display_load_config(&display_config);
+       if (ret_val == 0 && display_config)
+               EXPECT_EQ(display_config->display_dpms_type, SYSCOMMON_DEVICED_DPMS_TYPE_NONE);
+}
\ No newline at end of file