From fa78b4ea5b45d5e015c7a5dcd70aac548f6932f3 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 18 Aug 2023 15:48:58 +0900 Subject: [PATCH] display: Replace display_config to the libsyscommon one The enums that had been used by display_config are also replaced with that of the libsyscommon. - enum display_dpms_type -> enum deviced_dpms_type - enum display_init_direction_e -> enum deviced_display_orientation Change-Id: I8995957bfdfba74b65b4bf16d8e8225104ab6315 Signed-off-by: Youngjae Cho --- plugins/iot-headed/display/core.c | 8 +++--- plugins/iot-headed/display/device-interface.c | 2 +- plugins/iot-headed/display/key-filter.c | 2 +- plugins/mobile/display/core.c | 9 +++--- plugins/mobile/display/device-interface.c | 2 +- plugins/mobile/display/key-filter.c | 2 +- plugins/tv/display/core.c | 9 +++--- plugins/tv/display/device-interface.c | 2 +- plugins/tv/display/key-filter.c | 2 +- .../wearable/display/auto-brightness-sensorhub.c | 2 +- plugins/wearable/display/core.c | 9 +++--- plugins/wearable/display/device-interface.c | 2 +- plugins/wearable/display/key-filter.c | 2 +- src/display/core.h | 2 +- src/display/display-config.c | 8 +++--- src/display/display-config.h | 33 ++-------------------- src/display/display-dbus.c | 3 +- src/display/display-dpms.c | 5 ++-- src/display/display-dpms.h | 5 ---- src/display/display-plugin.h | 2 +- src/display/display.c | 6 ++-- src/display/display.h | 9 ++---- 22 files changed, 46 insertions(+), 80 deletions(-) diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 1eb55c5..9d53210 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -73,7 +73,7 @@ static struct state states[DEVICED_DISPLAY_STATE_END] = { #define CONTINUOUS_SAMPLING 1 #define LCDOFF_TIMEOUT 300 /* milli second */ -static struct display_config display_conf = { +static struct deviced_display_config display_conf = { .lock_wait_time = LOCK_SCREEN_WATING_TIME, .longpress_interval = LONG_PRESS_INTERVAL, .lightsensor_interval = SAMPLING_INTERVAL, @@ -89,15 +89,15 @@ static struct display_config display_conf = { .continuous_sampling = CONTINUOUS_SAMPLING, .timeout_enable = true, .input_support = true, - .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, + .display_init_direction = DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, .display_on_usb_conn_changed = true, - .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER, + .display_dpms_type = DEVICED_DPMS_TYPE_WINDOW_MANAGER, }; -inline const struct display_config* get_var_display_config() +inline const struct deviced_display_config* get_var_display_config() { return &display_conf; } diff --git a/plugins/iot-headed/display/device-interface.c b/plugins/iot-headed/display/device-interface.c index caa3236..a3e5a73 100644 --- a/plugins/iot-headed/display/device-interface.c +++ b/plugins/iot-headed/display/device-interface.c @@ -36,7 +36,7 @@ #include "device-interface.h" static struct display_backlight_ops backlight_ops; -static const struct display_config *display_conf; +static const struct deviced_display_config *display_conf; inline struct display_backlight_ops *get_var_backlight_ops(void) { diff --git a/plugins/iot-headed/display/key-filter.c b/plugins/iot-headed/display/key-filter.c index fef3c07..5f2aa30 100644 --- a/plugins/iot-headed/display/key-filter.c +++ b/plugins/iot-headed/display/key-filter.c @@ -447,7 +447,7 @@ static int process_power_key(struct input_event *pinput) int ignore = true; static int value = KEY_RELEASED; unsigned int caps; - const struct display_config *display_conf = get_var_display_config(); + const struct deviced_display_config *display_conf = get_var_display_config(); if (!display_conf) { _E("Failed to get display configuration variable."); return ignore; diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index 8cfbaf2..6638b9d 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -101,7 +102,7 @@ static struct state states[DEVICED_DISPLAY_STATE_END] = { #define CONTINUOUS_SAMPLING 1 #define LCDOFF_TIMEOUT 300 /* milli second */ -static struct display_config display_conf = { +static struct deviced_display_config display_conf = { .lock_wait_time = LOCK_SCREEN_WATING_TIME, .longpress_interval = LONG_PRESS_INTERVAL, .lightsensor_interval = SAMPLING_INTERVAL, @@ -117,15 +118,15 @@ static struct display_config display_conf = { .continuous_sampling = CONTINUOUS_SAMPLING, .timeout_enable = true, .input_support = true, - .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, + .display_init_direction = DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, .display_on_usb_conn_changed = true, - .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER, + .display_dpms_type = DEVICED_DPMS_TYPE_WINDOW_MANAGER, }; -inline const struct display_config* get_var_display_config() +inline const struct deviced_display_config* get_var_display_config() { return &display_conf; } diff --git a/plugins/mobile/display/device-interface.c b/plugins/mobile/display/device-interface.c index 0b70680..feec858 100644 --- a/plugins/mobile/display/device-interface.c +++ b/plugins/mobile/display/device-interface.c @@ -47,7 +47,7 @@ #include "power/power-suspend.h" static struct display_backlight_ops backlight_ops; -static const struct display_config *display_conf; +static const struct deviced_display_config *display_conf; inline struct display_backlight_ops *get_var_backlight_ops(void) { diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index 32edcdf..61257a8 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -458,7 +458,7 @@ static int process_power_key(struct input_event *pinput) int ignore = true; static int value = KEY_RELEASED; unsigned int caps; - const struct display_config *display_conf = get_var_display_config(); + const struct deviced_display_config *display_conf = get_var_display_config(); if (!display_conf) { _E("Failed to get display configuration variable."); return ignore; diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index 7aa70c6..8dafefa 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "ambient-mode.h" @@ -99,7 +100,7 @@ static struct state states[DEVICED_DISPLAY_STATE_END] = { #define CONTINUOUS_SAMPLING 1 #define LCDOFF_TIMEOUT 300 /* milli second */ -static struct display_config display_conf = { +static struct deviced_display_config display_conf = { .lock_wait_time = LOCK_SCREEN_WATING_TIME, .longpress_interval = LONG_PRESS_INTERVAL, .lightsensor_interval = SAMPLING_INTERVAL, @@ -115,15 +116,15 @@ static struct display_config display_conf = { .continuous_sampling = CONTINUOUS_SAMPLING, .timeout_enable = true, .input_support = true, - .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, + .display_init_direction = DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, .display_on_usb_conn_changed = true, - .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER, + .display_dpms_type = DEVICED_DPMS_TYPE_WINDOW_MANAGER, }; -inline const struct display_config* get_var_display_config() +inline const struct deviced_display_config* get_var_display_config() { return &display_conf; } diff --git a/plugins/tv/display/device-interface.c b/plugins/tv/display/device-interface.c index 19f30b5..01aeadd 100644 --- a/plugins/tv/display/device-interface.c +++ b/plugins/tv/display/device-interface.c @@ -46,7 +46,7 @@ #include "display-lock.h" static struct display_backlight_ops backlight_ops; -static const struct display_config *display_conf; +static const struct deviced_display_config *display_conf; inline struct display_backlight_ops *get_var_backlight_ops(void) { diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index 73b4252..ca75646 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -439,7 +439,7 @@ static int process_power_key(struct input_event *pinput) int ignore = true; static int value = KEY_RELEASED; unsigned int caps; - const struct display_config *display_conf = get_var_display_config(); + const struct deviced_display_config *display_conf = get_var_display_config(); if(!display_conf) { _E("Failed to get display configuration variable."); return ignore; diff --git a/plugins/wearable/display/auto-brightness-sensorhub.c b/plugins/wearable/display/auto-brightness-sensorhub.c index 6fc0d22..de05a05 100644 --- a/plugins/wearable/display/auto-brightness-sensorhub.c +++ b/plugins/wearable/display/auto-brightness-sensorhub.c @@ -48,7 +48,7 @@ static bool lbm, hbm, hold_brt, lowdim; static void change_brightness_transit(int start, int end) { - const struct display_config *display_conf = get_var_display_config(); + const struct deviced_display_config *display_conf = get_var_display_config(); if(!display_conf) { _E("Failed to get display configuration variable."); return ; diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index 99c0409..bc96b51 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -124,7 +125,7 @@ static struct state states[DEVICED_DISPLAY_STATE_END] = { #define FORCE_RELEASE_LOCK_INTERVAL 5 /* seconds */ -static struct display_config display_conf = { +static struct deviced_display_config display_conf = { .lock_wait_time = LOCK_SCREEN_WATING_TIME, .longpress_interval = LONG_PRESS_INTERVAL, .lightsensor_interval = SAMPLING_INTERVAL, @@ -140,15 +141,15 @@ static struct display_config display_conf = { .continuous_sampling = CONTINUOUS_SAMPLING, .timeout_enable = true, .input_support = true, - .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, + .display_init_direction = DEVICED_DISPLAY_ORIENTATION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, .display_on_usb_conn_changed = true, - .display_dpms_type = DISPLAY_DPMS_TYPE_WINDOW_MANAGER, + .display_dpms_type = DEVICED_DPMS_TYPE_WINDOW_MANAGER, }; -inline const struct display_config *get_var_display_config() +inline const struct deviced_display_config *get_var_display_config() { return &display_conf; } diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c index 413bbd2..07cac36 100644 --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -59,7 +59,7 @@ static int aod_max_level = -1; static int aod_normal_level = -1; static int aod_min_level = -1; static int aod_charging_level = -1; -static const struct display_config *display_conf; +static const struct deviced_display_config *display_conf; static struct battery_status *battery = NULL; static struct battery_status* (*fp_get_var_battery_status)(void); diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index fdf1080..b655f29 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -419,7 +419,7 @@ static int process_power_key(struct input_event *pinput) int ignore = true; static int value = KEY_RELEASED; unsigned int caps; - const struct display_config *display_conf = get_var_display_config(); + const struct deviced_display_config *display_conf = get_var_display_config(); if (!display_conf) { _E("Failed to get display configuration variable."); return ignore; diff --git a/src/display/core.h b/src/display/core.h index 937634f..f00ef9a 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -70,7 +70,7 @@ struct state *state_st(enum deviced_display_state state); * Global variables * display_conf : configuration of display */ -const struct display_config* get_var_display_config(); +const struct deviced_display_config* get_var_display_config(); typedef struct { pid_t pid; diff --git a/src/display/display-config.c b/src/display/display-config.c index b138a8b..874cd4d 100644 --- a/src/display/display-config.c +++ b/src/display/display-config.c @@ -28,7 +28,7 @@ static int display_config_parse(struct parse_result *result, void *user_data) { - struct display_config *c = user_data; + struct deviced_display_config *c = user_data; _D("display_load_config: section=%s name=%s value=%s", result->section, result->name, result->value); @@ -93,16 +93,16 @@ static int display_config_parse(struct parse_result *result, void *user_data) c->display_on_usb_conn_changed = (MATCH(result->value, "yes") ? true : false); } else if (MATCH(result->name, "DisplayInitDirection")) { c->display_init_direction = (MATCH(result->value, "vertical") ? \ - DISPLAY_INIT_DIRECTION_VERTICAL : DISPLAY_INIT_DIRECTION_HORIZONTAL); + DEVICED_DISPLAY_ORIENTATION_VERTICAL : DEVICED_DISPLAY_ORIENTATION_HORIZONTAL); } else if (MATCH(result->name, "DisplayDPMSType")) { c->display_dpms_type = (MATCH(result->value, "none") ? \ - DISPLAY_DPMS_TYPE_NONE : DISPLAY_DPMS_TYPE_WINDOW_MANAGER); + DEVICED_DPMS_TYPE_NONE : DEVICED_DPMS_TYPE_WINDOW_MANAGER); } return 0; } -int display_load_config(struct display_config *config) +int display_load_config(struct deviced_display_config *config) { return config_parse(DISPLAY_CONF_FILE, display_config_parse, config); } diff --git a/src/display/display-config.h b/src/display/display-config.h index be967c9..27d65b3 100644 --- a/src/display/display-config.h +++ b/src/display/display-config.h @@ -19,39 +19,10 @@ #ifndef __DISPLAY_CONFIG_H__ #define __DISPLAY_CONFIG_H__ -#include -#include "display-panel.h" +#include #define DISPLAY_CONF_FILE "/etc/deviced/display.conf" -/* - * @brief Configuration structure - */ -struct display_config { - double lock_wait_time; - double longpress_interval; - double lightsensor_interval; - int lcdoff_timeout; - const int pm_default_brightness; - int brightness_change_step; - int lcd_always_on; - int dimming; - int framerate_app[4]; - int control_display; - int powerkey_doublepress; - int alpm_on; - int accel_sensor_on; - int continuous_sampling; - int display_init_direction; - int aod_enter_level; - bool aod_tsp; - bool timeout_enable; - bool input_support; - bool touch_wakeup; - bool display_on_usb_conn_changed; - - enum display_dpms_type display_dpms_type; -}; -int display_load_config(struct display_config *config); +int display_load_config(struct deviced_display_config *config); #endif //__DISPLAY_CONFIG_H__ diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 4bc3c5d..06ec586 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -1354,7 +1355,7 @@ static GVariant *dbus_getrotationangle(GDBusConnection *conn, int ret; int display_index; enum hal_device_display_rotation_angle angle; - enum display_init_direction_e init_direction; + enum deviced_display_orientation init_direction; g_variant_get(param, "(i)", &display_index); ret = hal_device_display_get_rotation_angle(display_index, &angle); diff --git a/src/display/display-dpms.c b/src/display/display-dpms.c index 4c4f38a..d041030 100644 --- a/src/display/display-dpms.c +++ b/src/display/display-dpms.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "core/log.h" #include "shared/device-notifier.h" @@ -657,14 +658,14 @@ bool dpms_init(void) } switch (g_display_plugin.config->display_dpms_type) { - case DISPLAY_DPMS_TYPE_WINDOW_MANAGER: + case DEVICED_DPMS_TYPE_WINDOW_MANAGER: g_dpms_ops.set_state = wm_dpms_set_state; g_dpms_ops.get_state = wm_dpms_get_state; g_dpms_ops.get_cached_state = wm_dpms_get_cached_state; g_dpms_ops.init = wm_dpms_init; g_dpms_ops.exit = wm_dpms_exit; break; - case DISPLAY_DPMS_TYPE_NONE: + case DEVICED_DPMS_TYPE_NONE: g_dpms_ops.set_state = none_dpms_set_state; g_dpms_ops.get_state = none_dpms_get_state; g_dpms_ops.get_cached_state = none_dpms_get_cached_state; diff --git a/src/display/display-dpms.h b/src/display/display-dpms.h index 8e1447f..9914048 100644 --- a/src/display/display-dpms.h +++ b/src/display/display-dpms.h @@ -31,11 +31,6 @@ enum dpms_state { DPMS_DETACH, /* Display detached */ }; -enum display_dpms_type { - DISPLAY_DPMS_TYPE_NONE, - DISPLAY_DPMS_TYPE_WINDOW_MANAGER, -}; - void dpms_set_state(int on); int dpms_get_state(void); int dpms_get_cached_state(void); diff --git a/src/display/display-plugin.h b/src/display/display-plugin.h index 7b567a5..5040bb1 100644 --- a/src/display/display-plugin.h +++ b/src/display/display-plugin.h @@ -75,7 +75,7 @@ struct display_plugin { void (*reset_autobrightness_min) (GDBusConnection *conn, const gchar *sender, const gchar *unique_name, gpointer data); - struct display_config *config; + struct deviced_display_config *config; struct display_backlight_ops *backlight; struct state* display_states[DEVICED_DISPLAY_STATE_END]; }; diff --git a/src/display/display.c b/src/display/display.c index 131a2a0..ec42d05 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -45,7 +45,7 @@ static const struct device_ops *display_plugin_device_ops; static unsigned int pm_status_flag; -static enum display_init_direction_e g_display_init_direction; +static enum deviced_display_orientation g_display_init_direction; static bool g_display_hal_backend_available = false; static GList *display_dependent_device_ops; static enum device_ops_status display_ops_status = DEVICE_OPS_STATUS_UNINIT; @@ -67,12 +67,12 @@ inline void clear_pm_status_flag(unsigned int status_flag) pm_status_flag &= ~status_flag; } -inline enum display_init_direction_e get_display_init_direction(void) +inline enum deviced_display_orientation get_display_init_direction(void) { return g_display_init_direction; } -inline void set_display_init_direction(enum display_init_direction_e display_init_direction) +inline void set_display_init_direction(enum deviced_display_orientation display_init_direction) { g_display_init_direction = display_init_direction; } diff --git a/src/display/display.h b/src/display/display.h index 697979a..011d690 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -34,11 +34,6 @@ #define BATTERY_FLAG 0x00020000 #define COOLDOWN_FLAG 0x00040000 -enum display_init_direction_e { - DISPLAY_INIT_DIRECTION_HORIZONTAL, - DISPLAY_INIT_DIRECTION_VERTICAL, -}; - void lcd_direct_control(enum dpms_state dpms_state, int flags); int get_pm_cur_state(void); int get_pm_old_state(void); @@ -47,8 +42,8 @@ void set_pm_old_state(int old_state); unsigned int get_pm_status_flag(void); void set_pm_status_flag(unsigned int status_flag); void clear_pm_status_flag(unsigned int status_flag); -enum display_init_direction_e get_display_init_direction(void); -void set_display_init_direction(enum display_init_direction_e display_init_direction); +enum deviced_display_orientation get_display_init_direction(void); +void set_display_init_direction(enum deviced_display_orientation display_init_direction); bool display_is_hal_backend_available(void); void display_start_dependent_device(unsigned long flags); void display_stop_dependent_device(unsigned long flags); -- 2.7.4