Closed
Bug 887627
Opened 11 years ago
Closed 11 years ago
(gonk-jb) nsWindow: Avoid /sys/power/wait_for_fb_* on JB
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: m1, Assigned: m1)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
m1
:
review+
|
Details | Diff | Splinter Review |
As we move away from Android wake locks in JB the legacy /sys/power/wait_for_fb_{sleep,wake} have been removed [1].
Luckly it seems that we don't need this on JB at all as the hw_composer's blank method [2] does not return until the operation is complete. This hopefully will work even for JB ports that have yet to remove this legacy kernel code.
[1] https://www.codeaurora.org/cgit/quic/la/kernel/msm/commit/?id=f85607a715a74c65db812cd3901022888257f966
[2] https://www.codeaurora.org/cgit/quic/la/platform/hardware/libhardware/tree/include/hardware/hwcomposer.h?h=b2g/jb_mr1_rb2.17#n510
Assignee | ||
Comment 1•11 years ago
|
||
This seems to work for both my ICS and JB devices, with a hack to widget/gonk/libdisplay/GonkDisplay.cpp not supplied here (see the #error in the patch).
It would be convenient to continue to use mozilla::ReadSysFile [1], however this is not exported by libxul ATM it seems. But we could also potentially revert back to the b2g18 method as well [2].
[1] http://mxr.mozilla.org/mozilla-central/source/xpcom/glue/FileUtils.h#178
[2] http://mxr.mozilla.org/mozilla-b2g18/source/widget/gonk/nsWindow.cpp#121
Attachment #768155 -
Flags: feedback?(mwu)
Comment 2•11 years ago
|
||
Comment on attachment 768155 [details] [diff] [review]
WIP
Review of attachment 768155 [details] [diff] [review]:
-----------------------------------------------------------------
Overall approach here looks good to me.
::: widget/gonk/libdisplay/GonkDisplayICS.cpp
@@ +47,5 @@
> +#error Can't link with ReadSysFile() from here...
> + while (true) {
> + // Cannot use epoll here because kSleepFile and kWakeFile are
> + // always ready to read and blocking.
> + ret = mozilla::ReadSysFile(kSleepFile, &buf, sizeof(buf));
IIRC we did this manually before instead of using ReadSysFile. I wouldn't mind switching back to checking this file manually.
Attachment #768155 -
Flags: feedback?(mwu) → feedback+
Comment 3•11 years ago
|
||
BTW, is wait_for_fb_* removed on your port, or still there?
Assignee | ||
Comment 4•11 years ago
|
||
It's gone in our code base entirely. Does this patch work ok on your Nexus 4?
Comment 5•11 years ago
|
||
Appears to work. The screen seems to turn on faster too.
Assignee | ||
Comment 6•11 years ago
|
||
Attachment #768155 -
Attachment is obsolete: true
Attachment #768635 -
Flags: review?(mwu)
Comment 7•11 years ago
|
||
Comment on attachment 768635 [details] [diff] [review]
v1
Review of attachment 768635 [details] [diff] [review]:
-----------------------------------------------------------------
Mostly nits. Looks good overall - thanks.
::: widget/gonk/libdisplay/GonkDisplayICS.cpp
@@ +34,5 @@
> +
> +namespace {
> +static const char* kSleepFile = "/sys/power/wait_for_fb_sleep";
> +static const char* kWakeFile = "/sys/power/wait_for_fb_wake";
> +static mozilla::GonkDisplay::OnEnabledCallbackType sEnabledCallback = nullptr;
Static globals are zero/null by default. I know sGonkDisplay is being explicitly nulled elsewhere in this file.. that is a mistake.
@@ +65,5 @@
> + }
> + sEnabledCallback(true);
> + }
> +
> + return NULL;
nullptr
@@ +141,5 @@
>
> +void
> +GonkDisplayICS::OnEnabled(OnEnabledCallbackType callback)
> +{
> + if (sEnabledCallback) return;
return on the next line
@@ +146,5 @@
> + sEnabledCallback = callback;
> +
> + // Watching screen on/off state by using a pthread
> + // which implicitly calls exit() when the main thread ends
> + if (pthread_create(&sFramebufferWatchThread, NULL, frameBufferWatcher, NULL)) {
nullptr
::: widget/gonk/libdisplay/GonkDisplayJB.cpp
@@ +131,5 @@
>
> +void
> +GonkDisplayJB::OnEnabled(OnEnabledCallbackType callback)
> +{
> + mEnabledCallback = callback;
This file uses four space indents.
::: widget/gonk/nsWindow.cpp
@@ +115,5 @@
> bool mIsOn;
> };
>
> +static nsRefPtr<ScreenOnOffEvent> sScreenOnEvent = new ScreenOnOffEvent(true);
> +static nsRefPtr<ScreenOnOffEvent> sScreenOffEvent = new ScreenOnOffEvent(false);
StaticRefPtr is more appropriate in this case. It'll need to be combined with a call to ClearOnShutdown to avoid being counted as a shutdown leak.
Attachment #768635 -
Flags: review?(mwu) → review+
Assignee | ||
Comment 8•11 years ago
|
||
review comments addressed, carrying over r+
Attachment #768635 -
Attachment is obsolete: true
Attachment #769832 -
Flags: review+
Assignee | ||
Comment 9•11 years ago
|
||
Try build looks pretty green: https://tbpl.mozilla.org/?tree=Try&rev=3d9aba4acba7
Assignee | ||
Comment 10•11 years ago
|
||
Assignee | ||
Comment 11•11 years ago
|
||
(Apologies, I should have landed this in birch. Please feel free to back me out and abuse me in any way you see fit)
Comment 12•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/40a51c5dca9e
BURN THE WITCH!!!
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•