[unagi][b2g][gecko]Rendering was still going after screen was light off.

RESOLVED WONTFIX

Status

Firefox OS
General
P3
normal
RESOLVED WONTFIX
5 years ago
2 months ago

People

(Reporter: ying.xu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17

Steps to reproduce:

Press power to turn off the backlight of screen,  and attach b2g process with gdb,

Add a breakpoint at mozilla::layers::LayerManagerOGL::Render, wait a few second,



Actual results:

Function Render was called.


Expected results:

We think do not need rendering after the backlight of screen was off,
  to decrease power consumption.
(Reporter)

Comment 1

5 years ago
#0  mozilla::layers::LayerManagerOGL::Render (this=0x488eb130)
    at /home/apusr/b2gsource/unagi/gecko/gfx/layers/opengl/LayerManagerOGL.cpp:941
#1  0x41440d66 in mozilla::layers::LayerManagerOGL::EndTransaction (
    this=0x488eb130, aCallback=0, aCallbackData=0x0, 
    aFlags=<value optimized out>)
    at /home/apusr/b2gsource/unagi/gecko/gfx/layers/opengl/LayerManagerOGL.cpp:700
#2  0x4143e8de in mozilla::layers::LayerManagerOGL::EndEmptyTransaction (
    this=0x488eb130, aFlags=9335212)
    at /home/apusr/b2gsource/unagi/gecko/gfx/layers/opengl/LayerManagerOGL.cpp:641
#3  0x4144c276 in mozilla::layers::CompositorParent::Composite (
    this=<value optimized out>)
    at /home/apusr/b2gsource/unagi/gecko/gfx/layers/ipc/CompositorParent.cpp:555
#4  0x412aa98a in DispatchToMethod<mozilla::dom::ContentParent, void (mozilla::dom::ContentParent::*)()> (this=<value optimized out>)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/tuple.h:383
#5  RunnableMethod<mozilla::dom::ContentParent, void (mozilla::dom::ContentParent::*)(), Tuple0>::Run (this=<value optimized out>)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/task.h:307
#6  0x413f0430 in MessageLoop::RunTask (this=0x43f1bdf0, task=0x43f1bc28)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:334
#7  0x413f1262 in MessageLoop::DeferOrRunPendingTask (this=0x488eb130, 
    pending_task=<value optimized out>)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:342
#8  0x413f1e40 in MessageLoop::DoWork (this=0x43f1bdf0)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:442
#9  0x413f20c0 in base::MessagePumpDefault::Run (this=0x43d02fc0, 
    delegate=0x43f1bdf0)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_pump_default.cc:23
#10 0x413f03e0 in MessageLoop::RunInternal (this=0x0)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:216
#11 0x413f0496 in MessageLoop::RunHandler (this=0x43f1bdf0)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:209
#12 MessageLoop::Run (this=0x43f1bdf0)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/message_loop.cc:183
#13 0x413f87a4 in base::Thread::ThreadMain (this=0x421a7430)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/thread.cc:156
#14 0x41402778 in ThreadFunc (closure=0x1)
    at /home/apusr/b2gsource/unagi/gecko/ipc/chromium/src/base/platform_thread_posix.cc:39
#15 0x400afe18 in __thread_entry (func=0x41402771 <ThreadFunc>, 
    arg=0x421a7430, tls=<value optimized out>)
    at bionic/libc/bionic/pthread.c:217
#16 0x400af96c in pthread_create (thread_out=<value optimized out>, 
    attr=0xbee1d298, start_routine=0x41402771 <ThreadFunc>, arg=0x421a7430)
    at bionic/libc/bionic/pthread.c:357
#17 0x00000000 in ?? ()
OS: All → Gonk (Firefox OS)
Priority: -- → P3
Hardware: All → ARM
(In reply to ying.xu from comment #0)
> User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.17 (KHTML, like
> Gecko) Chrome/24.0.1312.56 Safari/537.17
> 
> Steps to reproduce:
> 
> Press power to turn off the backlight of screen,  and attach b2g process
> with gdb,
> 
> Add a breakpoint at mozilla::layers::LayerManagerOGL::Render, wait a few
> second,
> 
> 
> 
> Actual results:
> 
> Function Render was called.
> 
> 
> Expected results:
> 
> We think do not need rendering after the backlight of screen was off,
>   to decrease power consumption.

What was the foreground app when you turn off the screen?
(Reporter)

Comment 3

5 years ago
homescreen

i think it's the wifi signal icon of statusbar that caused refreshment
IIRC, wifi signal icon is drawn by system app.
We skip redraw if the screen is off:
https://mxr.mozilla.org/mozilla-central/source/widget/gonk/nsWindow.cpp#200

Maybe hal::GetScreenEnabled() returned true here?
(Reporter)

Comment 6

5 years ago
I can confirm that nsWindow::DoDraw was returned at the point of hal::GetScreenEnabled() checking

but mozilla::layers::LayerManagerOGL::Render was still called 
in a duration about one minute
I feel wifi signal icon update task in gaia side should also be stopped. It wake up cpu and spend extra power.
(In reply to Sotaro Ikeda [:sotaro] from comment #7)
> I feel wifi signal icon update task in gaia side should also be stopped. It
> wake up cpu and spend extra power.

Normally this is the case because the CPU will be suspended. But the USB cable (for adb) blocks suspend so you can still see some CPU activities.
(In reply to Kan-Ru Chen [:kanru] from comment #8)
> Normally this is the case because the CPU will be suspended. But the USB
> cable (for adb) blocks suspend so you can still see some CPU activities.

Sorry for my silly comment #7. When cpu is in deep sleep mode. Only interrupt could wake up the cpu. So if the signal icon update task does not trigger the interrupt, the task will delay until next cpu wakeup. I do not know whether the task trigger the cpu interrupt and whether USB cable unplugged state just prevent cpu come into deep sleep mode or do more about to prevent task to run.
(Reporter)

Comment 10

5 years ago
I did some test, to exclude the case of usb cable .
we know the android log system has a large buffer.
when the usb cable was not plugged in , the log was still output to the buffer.
With the usb cable being plugged in again and executing cmd adb shell logcat,
we could get the log happened during the time without the usb cable plungged in.
So I added some log in both function nsWindow::DoDraw and LayerManagerOGL::Render,
Then I found LayerManagerOGL::Render was still called when hal::GetScreenEnabled() == false for about 5 minutes.
I think there is a path that does not use nsWindow::DoDraw() to update rendering, like CSS Animations/CSS Transform. So, to stop rendering update, it is necessary to tell compositor not to update rendering. But even doing it, CSS Animation task could run and consume cpu time. Therefore it is better to stop all drawing update at the source app.

Comment 12

2 months ago
Firefox OS is not being worked on
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.