Closed Bug 1144103 Opened 10 years ago Closed 10 years ago

Support screen recording

Categories

(Firefox OS Graveyard :: GonkIntegration, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox45 fixed)

RESOLVED FIXED
2.6 S1 - 11/20
Tracking Status
firefox45 --- fixed

People

(Reporter: gerard-majax, Assigned: sotaro)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 14 obsolete files)

16.14 KB, patch
sotaro
: review+
Details | Diff | Splinter Review
Hacking around in KK, I've sound the |screenrecord| binary on my device. This is built from https://android.googlesource.com/platform/frameworks/av/+/kitkat-mr2.2-release/cmds/screenrecord/screenrecord.cpp Running it quickly returns me an error: > ERROR: unable to get display characteristics Meaning the call to |err = SurfaceComposerClient::getDisplayInfo(mainDpy, &mainDpyInfo);| failed. I don't know well this part of the system, can we easily leverage this to support screen recording ?
Flags: needinfo?(sotaro.ikeda.g)
ISurfaceComposer's implementation is FakeSurfaceComposer. It implement only necessary few api now in gecko. We need to connect it to GonkDisplayJB and LayerManagerComposite need to support multiple rendering target. gerard-majax, can I take the bug? This might becomes necessary as basic capability for another capability like WifiDisplay.
Flags: needinfo?(sotaro.ikeda.g)
Feel tree to work on this :)
Assignee: nobody → sotaro.ikeda.g
This feature would be really great for automated QA testing, and I hope it gets included in 3.0 feature lists as well. I believe this is essentially same as the eideticker setup without the need for external camera, and perhaps we can do advanced image comparison tests with it.
Blocks: 1116089
Attached patch wip patch (obsolete) — Splinter Review
Implementing by using nexus-5-l. Recording works, but when finish recording, b2g process reboot.
Attached patch wip patch (obsolete) — Splinter Review
Fix crash when end recording. Removed redundant logs.
Attachment #8588888 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
correct patch.
Attachment #8589161 - Attachment is obsolete: true
attachment 8589163 [details] [diff] [review] have many changes. It seems better to handle some problems by sub bugs.
Depends on: 1151936
Depends on: 1152135
Depends on: 1152370
No longer blocks: 1116089
Attached patch wip patch (obsolete) — Splinter Review
un-bitrot.
Attachment #8589163 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
un-bitrot.
Attachment #8594820 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Update nits.
Attachment #8597312 - Attachment is obsolete: true
Depends on: 1138287, 1157441
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8597318 - Attachment is obsolete: true
Depends on: 1186000
Sotaro, do we have workable screenrecord tool for Aries? Thanks.
Flags: needinfo?(sotaro.ikeda.g)
Rebase and kk support.
Attachment #8636558 - Attachment is obsolete: true
Flags: needinfo?(sotaro.ikeda.g)
Picked change from L. Without this patch. screen record automatically finished very quickly.
(In reply to Bobby Chien [:bchien] from comment #14) > Sotaro, do we have workable screenrecord tool for Aries? Thanks. By applying attachment 8682947 [details] [diff] [review] and attachment 8682950 [details] [diff] [review]. I confirmed screenrecord on master aries(KK).
Depends on: 1221446
Sotaro, you mean your patch in comment 17 already landed on master/firefox45, right? Thanks.
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Bobby Chien [:bchien] from comment #18) > Sotaro, you mean your patch in comment 17 already landed on > master/firefox45, right? Thanks. They are not landed to yet.
Flags: needinfo?(sotaro.ikeda.g)
I created the patches in comment 17 yesterday and applied local master aries environment.
Depends on: 1221850
Depends on: 1223239
Attachment #8682950 - Attachment is obsolete: true
Rebased.
Attachment #8682947 - Attachment is obsolete: true
Code clean up.
Attachment #8687749 - Attachment is obsolete: true
Add a comment.
Attachment #8687776 - Attachment is obsolete: true
Fix build failure on JB.
Attachment #8687778 - Attachment is obsolete: true
Attachment #8687785 - Flags: review?(mwu)
Attachment #8687785 - Flags: review?(mwu)
Add pref check.
Attachment #8687785 - Attachment is obsolete: true
Attachment #8687789 - Flags: review?(mwu)
Comment on attachment 8687789 [details] [diff] [review] patch - Add Screen recording capability Review of attachment 8687789 [details] [diff] [review]: ----------------------------------------------------------------- Looks fine overall, though I guess we might want to rename FakeSurfaceComposer to GeckoSurfaceComposer later since so much is implemented now. r=me with nits, locking, and density detection fixed. ::: widget/gonk/nativewindow/FakeSurfaceComposer.cpp @@ +78,5 @@ > + MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread."); > + RefPtr<nsScreenManagerGonk> screenManager = > + nsScreenManagerGonk::GetInstance(); > + screenManager->RemoveScreen(GonkDisplay::DISPLAY_VIRTUAL); > + mComposer->mDisplays.removeItemsAt(mIndex); Displays are added to mDisplay on another thread but removed on the main thread. A lock is taken for adding the display, but not for removal, so I'm not sure how it's safe. @@ +107,5 @@ > + : composer(composer) { > + } > + }; > + > + if(!gfxPrefs::ScreenRecordingEnabled()) { nit: space after if @@ +178,5 @@ > + > + uint32_t flags = 0; > + DisplayDeviceState& disp(mDisplays.editValueAt(dpyIdx)); > + > + if (disp.isValid()) { nit: early return here to avoid an indenting the rest of the function. @@ +411,5 @@ > + if (Density::getEmuDensity()) { > + // if "qemu.sf.lcd_density" is specified, it overrides everything > + xdpi = ydpi = density = Density::getEmuDensity(); > + density /= 160.0f; > + } I think we should remove all this density logic and just use screen->GetDpi(). That's what gecko actually thinks the DPI is. ::: widget/gonk/nativewindow/FakeSurfaceComposer.h @@ +31,5 @@ > +#include <hardware/hwcomposer.h> > +#include <private/gui/LayerState.h> > +#include <utils/KeyedVector.h> > + > +#include "nsCOMPtr.h" Does this need to be here? I don't see nsCOMPtrs used in this header. @@ +128,5 @@ > + > + struct DisplayDeviceState { > + enum { > + NO_LAYER_STACK = 0xFFFFFFFF, > + }; nit: indentation @@ +152,5 @@ > + }; > + > + // access must be protected by mStateLock > + mutable Mutex mStateLock; > + DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> mDisplays; nit: remove the space before wp, if possible.
Attachment #8687789 - Flags: review?(mwu) → review+
(In reply to Michael Wu [:mwu] from comment #26) > Comment on attachment 8687789 [details] [diff] [review] > patch - Add Screen recording capability > > Review of attachment 8687789 [details] [diff] [review]: > ----------------------------------------------------------------- > > Looks fine overall, though I guess we might want to rename > FakeSurfaceComposer to GeckoSurfaceComposer later since so much is > implemented now. r=me with nits, locking, and density detection fixed. I am going to update the class name in a different bug. > > ::: widget/gonk/nativewindow/FakeSurfaceComposer.cpp > @@ +78,5 @@ > > + MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread."); > > + RefPtr<nsScreenManagerGonk> screenManager = > > + nsScreenManagerGonk::GetInstance(); > > + screenManager->RemoveScreen(GonkDisplay::DISPLAY_VIRTUAL); > > + mComposer->mDisplays.removeItemsAt(mIndex); > > Displays are added to mDisplay on another thread but removed on the main > thread. A lock is taken for adding the display, but not for removal, so I'm > not sure how it's safe. Thanks, loch is necessary for removal. I will update it in a next patch. > > @@ +107,5 @@ > > + : composer(composer) { > > + } > > + }; > > + > > + if(!gfxPrefs::ScreenRecordingEnabled()) { > > nit: space after if I'll update it in a next patch. > > @@ +178,5 @@ > > + > > + uint32_t flags = 0; > > + DisplayDeviceState& disp(mDisplays.editValueAt(dpyIdx)); > > + > > + if (disp.isValid()) { > > nit: early return here to avoid an indenting the rest of the function. I'll update it in a next patch. > > @@ +411,5 @@ > > + if (Density::getEmuDensity()) { > > + // if "qemu.sf.lcd_density" is specified, it overrides everything > > + xdpi = ydpi = density = Density::getEmuDensity(); > > + density /= 160.0f; > > + } > > I think we should remove all this density logic and just use > screen->GetDpi(). That's what gecko actually thinks the DPI is. Thanks. I'll update in a next patch. > > ::: widget/gonk/nativewindow/FakeSurfaceComposer.h > @@ +31,5 @@ > > +#include <hardware/hwcomposer.h> > > +#include <private/gui/LayerState.h> > > +#include <utils/KeyedVector.h> > > + > > +#include "nsCOMPtr.h" > > Does this need to be here? I don't see nsCOMPtrs used in this header. Until previous patch, it was necessary. I'll update it in a next patch. > > @@ +128,5 @@ > > + > > + struct DisplayDeviceState { > > + enum { > > + NO_LAYER_STACK = 0xFFFFFFFF, > > + }; > > nit: indentation I'll update it in a next patch. > > @@ +152,5 @@ > > + }; > > + > > + // access must be protected by mStateLock > > + mutable Mutex mStateLock; > > + DefaultKeyedVector< wp<IBinder>, DisplayDeviceState> mDisplays; > > nit: remove the space before wp, if possible. I'll update it in a next patch.
Apply the comment. Carry "r=mwu".
Attachment #8687789 - Attachment is obsolete: true
Attachment #8688271 - Flags: review+
Blocks: 1225402
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.6 S1 - 11/20
Blocks: 1225688
Hey Sotaro, could you quickly share how this works ? A pointer to an Internet resource works too :)
Flags: needinfo?(sotaro.ikeda.g)
Flip the pref layers.screen-recording.enabled, then adb shell; screenrecord /path/to/mp4
(In reply to Alexandre LISSY :gerard-majax from comment #33) > Flip the pref layers.screen-recording.enabled, then adb shell; screenrecord /path/to/mp4 Thanks. It should works on gonk kk and gonk L devices.
Flags: needinfo?(sotaro.ikeda.g)
I checked only on nexus-5-l and aries. I am going to check it on flame-kk.
(In reply to Sotaro Ikeda [:sotaro] from comment #36) > I checked only on nexus-5-l and aries. I am going to check it on flame-kk. flame-kk also works by "adb shell screenrecord /sdcard/screenrecord.mp4" with the pref enabled.
Depends on: 1228894
Hi Sotaro, I can't find layers.screen-recording.enabled in latest nexus-5-l build. Any trick? :)
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Bobby Chien [:bchien] from comment #38) > Hi Sotaro, I can't find layers.screen-recording.enabled in latest nexus-5-l > build. Any trick? :) It is because it is disabled by default. https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPrefs.h#317
Flags: needinfo?(sotaro.ikeda.g)
Depends on: 1229262
Sotaro, nexus 5 screenrecord is 16 fps per my own testing. Does it able to record as 30 or 60 fps? Thanks.
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Bobby Chien [:bchien] from comment #40) > Sotaro, nexus 5 screenrecord is 16 fps per my own testing. Does it able to > record as 30 or 60 fps? Thanks. Without modification of the code, it might be not possible. Optimization rendering path need to be implemented.
Flags: needinfo?(sotaro.ikeda.g)
Thanks so much for this sotaro!
Blocks: 1237914
Blocks: 1237069
Blocks: 1239964
Blocks: 1035134
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: