Closed Bug 1476380 Opened 2 years ago Closed 2 years ago

Remove the spin wait in Android gfxVRExternal PullState calls

Categories

(Core :: WebVR, enhancement)

Unspecified
Android
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: imanol, Assigned: imanol)

Details

Attachments

(3 files)

gfxVRExternal is using spin wait on Android instead of condition variables to wait for some conditions. This drains the battery on Android, specially when the headset goes to sleep, or Android activity gets paused: WebVR thread is constantly waiting for an update.
This patch that gets rid Android spin waits and used condition variables instead. I added a optional lambda function to PullState method which makes the Pullstate method to wait for state changes until the lambda condition is satisfied (== returns true). This way we can reuse the smae wait algorithm from different places (e.g. waiting for enumaration and waiting for a SubmitFrame result)
Attachment #8992735 - Flags: review?(kgilbert)
Attachment #8992735 - Flags: checkin?(kgilbert)
Comment on attachment 8992735 [details] [diff] [review]
Patch that gets rid of Android spin waits

checkin will be requested once the patch has been reviewed. Setting the keyword 'checkin-needed' is preferred.
Attachment #8992735 - Flags: checkin?(kgilbert)
Assignee: nobody → imanol
Status: NEW → ASSIGNED
Implemented the changes that Kip requested
Attachment #8992923 - Flags: review?(kgilbert)
Comment on attachment 8992923 [details] [diff] [review]
spin_wait_patch_v2.diff

This LGTM, Thanks!
Attachment #8992923 - Flags: review?(kgilbert) → review+
Comment on attachment 8994537 [details]
Bug 1476380 - Remove the spin wait in Android gfxVRExternal PullState calls;

https://reviewboard.mozilla.org/r/259086/#review266148

LGTM, Thanks!
Attachment #8994537 - Flags: review?(kgilbert) → review+
Keywords: checkin-needed
Pushed by kgilbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/30b7766e0f82
Remove the spin wait in Android gfxVRExternal PullState calls; r=kip
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/30b7766e0f82
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Comment on attachment 8992735 [details] [diff] [review]
Patch that gets rid of Android spin waits

Clearing review request, as other patch was landed.
Attachment #8992735 - Flags: review?(kgilbert)
You need to log in before you can comment on or make changes to this bug.