display: Change operation when system wakeup 29/291429/3 accepted/tizen/7.0/unified/20230424.020447
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 17 Apr 2023 01:00:06 +0000 (10:00 +0900)
committeryoungjae <y0.cho@samsung.com>
Tue, 18 Apr 2023 00:30:41 +0000 (09:30 +0900)
The callback power_resume_from_echomem_callback(), which is invoked on
finishing power transition, has changed to operate only when the display
state remains S_SLEEP. That is, if the display has turned on while wait
for other apps' notification that they're OK to proceed transition, the
callback has nothing to do. The below is an example of such case.
  1. An application has registered power state change callback on one of
     the resuming transient state. let's say it was
     DEVICED_POWER_TRANSIENT_STATE_RESUMING.
  2. The system is sleeping.
  3. There key input is coming. The system starts resuming.
  4. On the way of resuming, the deviced's power module waits for
     OK sign of the app against DEVICED_POWER_TRANSIENT_STATE_RESUMING.
     Following transitions will be delayed until the app's OK sign.
  5. While waiting for the app, the deviced turns display on by itself.
     The key input event is captured by input module. On detecting the
     key event, the input module triggers display to be turned on
     regardless of power state. It aims to user responsiveness. As a
     result, display state will be S_NORMAL.
  6. The deviced receives app's OK sign. Remaining resume transitions
     will take place.
  7. On finishing resuming, the power_resume_from_echomem_callback()
     is invoked. But the display has already been turned on by input
     module. In this case, this callback has nothing to do.

On the other hand, if an event wouldn't change the display state, it
is necessary for the callback to change display state. For example,
let's assume an event were RTC, not key input, on the step 3 above. In
this case, the deviced will not turn the display on by itself so the
step 5 won't take place. Therefore on finishing power transition, it
is necessary for the power_resume_from_echomem_callback() to change
display state manually from S_SLEEP.

Change-Id: I2f0f693317a2d4387a4478e391c0251da4b9db72
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/mobile/display/core.c

index 83d4672..6dfcf0f 100644 (file)
@@ -2036,6 +2036,15 @@ static int input_init_handler(void)
 static int power_resume_from_echomem_callback(void *data)
 {
        system_wakeup_flag = true;
+
+       /**
+        * If the display state has been changed to a state other than S_SLEEP at this point,
+        * we don't need to do anything. It is possible if powerkey input has turned on the display
+        * while waiting power transition. Otherwise, manually change state.
+        */
+       if (get_pm_cur_state() != S_SLEEP)
+               return 0;
+
        if (check_wakeup_src() == EVENT_DEVICE)
                /* system waked up by devices */
                states[get_pm_cur_state()].trans(EVENT_DEVICE);