From: TaeminYeom Date: Tue, 3 Jan 2023 10:53:48 +0000 (+0900) Subject: display: Add init direction in rotation angle X-Git-Tag: accepted/tizen/7.0/unified/20230111.015124~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ee7cf599a6a0b87739497b6481d771efa16749b;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: Add init direction in rotation angle init direction means the display direction of degree 0. It is needed to know physical display state by app. When deviced boot, it parses the conf file "/etc/deviced/display.conf" and it saves the initial display is horizontal or vertical. changed dbus method: dbus_getrotationangle path: "/Org/Tizen/System/DeviceD/Display" interace: "org.tizen.system.deviced.display" member: "GetRotationAngle" paremeter: "(i)", display index to get rotation angle. return: "(iii)", 0 on success, negative on error. enum display rotation angle to get. enum display initial direction. added configuration property: DisplayInitDirection : "horizontal" or "vertical" Change-Id: I9a45d06b712a04d79e8614bac5880d4be6fe4fd3 Signed-off-by: TaeminYeom --- diff --git a/conf/display-profile-iot-headed.conf b/conf/display-profile-iot-headed.conf index 7e3886ee..9d90031b 100644 --- a/conf/display-profile-iot-headed.conf +++ b/conf/display-profile-iot-headed.conf @@ -38,6 +38,10 @@ # Default: yes # DisplayOnUsbConnChanged=(yes or no) +# Display direction is horizontal or vertical when there is no rotation. +# Default: horizontal +# DisplayInitDirection=(horizontal or vertical) + LCDAlwaysOn=no TimeoutEnable=yes SleepSupport=no diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index bf72a899..2b7aa603 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -197,6 +197,7 @@ static struct display_config display_conf = { .timeout_enable = true, .input_support = true, .lockcheck_timeout = 600, + .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, @@ -2220,6 +2221,8 @@ static void display_init(void *data) if (display_conf.input_support) if (CHECK_OPS(keyfilter_ops, init)) keyfilter_ops->init(); + + set_display_init_direction(display_conf.display_init_direction); } } diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index bcc74884..11fe205e 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -199,6 +199,7 @@ static struct display_config display_conf = { .timeout_enable = true, .input_support = true, .lockcheck_timeout = 600, + .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, .aod_enter_level = 40, .aod_tsp = true, .touch_wakeup = false, @@ -2226,6 +2227,8 @@ static void display_init(void *data) if (display_conf.input_support) if (CHECK_OPS(keyfilter_ops, init)) keyfilter_ops->init(); + + set_display_init_direction(display_conf.display_init_direction); } } diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index d51dcf73..444f02c0 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -196,6 +196,7 @@ static struct display_config display_conf = { .continuous_sampling = CONTINUOUS_SAMPLING, .timeout_enable = true, .input_support = true, + .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, .lockcheck_timeout = 600, .aod_enter_level = 40, .aod_tsp = true, @@ -2217,6 +2218,8 @@ static void display_init(void *data) if (display_conf.input_support) if (CHECK_OPS(keyfilter_ops, init)) keyfilter_ops->init(); + + set_display_init_direction(display_conf.display_init_direction); } } diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index c3916b14..958b19a5 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -221,6 +221,7 @@ static struct display_config display_conf = { .timeout_enable = true, .input_support = true, .lockcheck_timeout = 600, + .display_init_direction = DISPLAY_INIT_DIRECTION_HORIZONTAL, .pmlock_check = pmlock_check, .aod_enter_level = 40, .aod_tsp = true, @@ -2542,6 +2543,8 @@ static void display_init(void *data) if (display_conf.input_support) if (CHECK_OPS(keyfilter_ops, init)) keyfilter_ops->init(); + + set_display_init_direction(display_conf.display_init_direction); } } diff --git a/src/display/core.h b/src/display/core.h index 94dab955..fb52ede3 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -107,6 +107,7 @@ struct display_config { int accel_sensor_on; int continuous_sampling; int lockcheck_timeout; + int display_init_direction; /* Define pmlock checker. * Return id of the lock checker. diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 9d97619d..5f530e54 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -1252,13 +1252,16 @@ 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; g_variant_get(param, "(i)", &display_index); ret = hal_device_display_get_rotation_angle(display_index, &angle); if (ret < 0) angle = HAL_DEVICE_DISPLAY_ROTATION_ANGLE_UNKNOWN; - return g_variant_new("(ii)", ret, angle); + init_direction = get_display_init_direction(); + + return g_variant_new("(iii)", ret, angle, init_direction); } static GVariant *dbus_setrotationangle(GDBusConnection *conn, @@ -1315,7 +1318,7 @@ static const dbus_method_s dbus_methods[] = { { "GetBrightnessInfo", NULL, "ii", dbus_getbrightnessinfo}, { "SetWhiteBalance", "ii", "i", dbus_setwhitebalance}, { "GetWhiteBalance", "i", "i", dbus_getwhitebalance}, - { "GetRotationAngle", "i", "ii", dbus_getrotationangle}, + { "GetRotationAngle", "i", "iii", dbus_getrotationangle}, { "SetRotationAngle", "iii", "i", dbus_setrotationangle} /* Add methods here */ }; diff --git a/src/display/display.c b/src/display/display.c index 7eea0ed1..ec819978 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -30,6 +30,7 @@ static int pm_cur_state; static int pm_old_state; static unsigned int pm_status_flag; +static enum display_init_direction_e g_display_init_direction; inline int get_pm_cur_state(void) { @@ -66,6 +67,16 @@ 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) +{ + return g_display_init_direction; +} + +inline void set_display_init_direction(enum display_init_direction_e display_init_direction) +{ + g_display_init_direction = display_init_direction; +} + void lcd_direct_control(enum dpms_state state, int flags) { const struct device_ops *ops = NULL; @@ -154,6 +165,9 @@ int display_load_config(struct parse_result *result, void *user_data) _D("TSP control at is %d at aod", c->aod_tsp); } else if (MATCH(result->name, "DisplayOnUsbConnChanged")) { 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); } return 0; diff --git a/src/display/display.h b/src/display/display.h index fd577c92..0ecfac51 100644 --- a/src/display/display.h +++ b/src/display/display.h @@ -31,6 +31,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); int display_load_config(struct parse_result *result, void *user_data); enum brightness_request_e { @@ -53,6 +55,11 @@ enum brightness_request_e { BR_MAX, }; +enum display_init_direction_e { + DISPLAY_INIT_DIRECTION_HORIZONTAL, + DISPLAY_INIT_DIRECTION_VERTICAL, +}; + /* request for brightness that managed internally. * BR_HOLD_BRIGHTNESS and BR_SET_BRIGHTNESS does not use this implicit brightness * for request, but explicitly request for a brightness value */