Closed
Bug 929973
Opened 11 years ago
Closed 11 years ago
Implement android::IGraphicBufferAlloc in B2G
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
1.3 Sprint 5 - 11/22
People
(Reporter: sotaro, Assigned: sotaro)
References
Details
Attachments
(1 file, 11 obsolete files)
9.39 KB,
patch
|
sotaro
:
review+
|
Details | Diff | Splinter Review |
New nexus7(2013 version) implement camera hal ver 3.0. If camera hal version is more than 2, Camera2Client is created in CameraService in mediaserver. The Camera2Client instantiates BufferQueue. The BufferQueue uses android::IGraphicBufferAlloc as Buffer allocator.
If we want to use CameraService without modifying it, we need to provide android::IGraphicBufferAlloc.
Assignee | ||
Updated•11 years ago
|
OS: Windows 7 → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → sotaro.ikeda.g
Comment 1•11 years ago
|
||
Very interesting idea.
Are you going to do that similar to what we've done in widget / gonk / libdisplay / GonkDisplayJB.cpp
#include <gui/GraphicBufferAlloc.h>
mAlloc = new GraphicBufferAlloc();
Here Gonk is just to allocate buffer for showing BootAnimation only.
But I think it's much more complicated for your objective(use CameraService without modifying it).
Assignee | ||
Comment 2•11 years ago
|
||
Confirmed camera preview and taking a photo on nexus-7(flo).
Assignee | ||
Comment 3•11 years ago
|
||
Fix nsAppShell::Init().
Attachment #829500 -
Attachment is obsolete: true
Assignee | ||
Comment 4•11 years ago
|
||
Implement ISurfaceComposer(SurfaceFlinger) just to provide ISurfaceComposer::createGraphicBufferAlloc().
Assignee | ||
Comment 5•11 years ago
|
||
Attachment #829513 -
Attachment is obsolete: true
Assignee | ||
Comment 6•11 years ago
|
||
Register FakeSurfaceComposer as SurfaceFlinger.
Assignee | ||
Comment 7•11 years ago
|
||
On b2g, rendering target is far wary from BufferQueue. Consumer needs to dequeue more buffers than Android one.
Assignee | ||
Comment 8•11 years ago
|
||
Assignee | ||
Comment 9•11 years ago
|
||
Video recording are still failing on nexus-7. For the recording, at least Bug 910498 needs to be fixed.
Assignee | ||
Updated•11 years ago
|
Attachment #829517 -
Flags: review?(mwu)
Assignee | ||
Updated•11 years ago
|
Attachment #829518 -
Flags: review?(mwu)
Assignee | ||
Updated•11 years ago
|
Attachment #829520 -
Flags: review?(mwu)
Assignee | ||
Updated•11 years ago
|
Attachment #829524 -
Flags: review?(mwu)
Assignee | ||
Updated•11 years ago
|
Attachment #829525 -
Flags: review?(mhabicher)
Assignee | ||
Comment 10•11 years ago
|
||
Until android 4.2, the graphic buffers for taking pictures were allocated in camera hal by platform specific ways. Since android 4.3, new camera hal is going to allocate the buffers by using IGraphicBufferProducer interface. Camera preview's graphic buffers are allocated same way as before.
Assignee | ||
Updated•11 years ago
|
blocking-b2g: --- → 1.3?
Comment 11•11 years ago
|
||
Comment on attachment 829525 [details] [diff] [review]
patch part 5 - Add null check to GonkCameraHardware::OnNewFrame()
Review of attachment 829525 [details] [diff] [review]:
-----------------------------------------------------------------
Looks simple enough. Under what circumstances do you expect us to get an OnNewFrame() event, but we're unable to get a 'buffer'?
Attachment #829525 -
Flags: review?(mhabicher) → review+
Assignee | ||
Comment 12•11 years ago
|
||
(In reply to Mike Habicher [:mikeh] from comment #11)
>
> Looks simple enough. Under what circumstances do you expect us to get an
> OnNewFrame() event, but we're unable to get a 'buffer'?
Current master gecko's GonkBufferQueue limits the number of buffers got by Consumer side. This causes the nullptr. The crash was happened often after taking a photo or attach a GDB. This limitation is going to be removed by attachment 829524 [details] [diff] [review].
Updated•11 years ago
|
Attachment #829518 -
Flags: review?(mwu) → review?(mh+mozilla)
Comment 13•11 years ago
|
||
Comment on attachment 829520 [details] [diff] [review]
patch part 3 - Instantiate and register FakeSurfaceComposer
Review of attachment 829520 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/gonk/nsAppShell.cpp
@@ +745,5 @@
> #endif
> +#if ANDROID_VERSION >= 18
> + if (XRE_GetProcessType() == GeckoProcessType_Default) {
> + android::FakeSurfaceComposer::instantiate();
> + }
Can you clean this up a little bit while you're at it? Combine this if block into the one above it, and make sure they both use 4 space indents instead of the broken indentation we currently have.
Attachment #829520 -
Flags: review?(mwu) → review+
Comment 14•11 years ago
|
||
Comment on attachment 829517 [details] [diff] [review]
patch part 1 - Add FakeSurfaceComposer
Review of attachment 829517 [details] [diff] [review]:
-----------------------------------------------------------------
::: widget/gonk/nativewindow/FakeSurfaceComposer.cpp
@@ +58,5 @@
> +}
> +
> +/* static */
> +void FakeSurfaceComposer::instantiate() {
> + waitServiceManager();
Do we need this? I don't really see examples of code spinning in a loop waiting for the service manager.
@@ +59,5 @@
> +
> +/* static */
> +void FakeSurfaceComposer::instantiate() {
> + waitServiceManager();
> + waitBeforeAdding( android::String16("SurfaceFlinger") );
On a normal B2G phone, the only process that would claim to be SurfaceFlinger should be this process, since the surfaceflinger binary shouldn't be installed. Does this cover the possibility that the service manager doesn't remove the service quickly enough if we crash?
Comment 15•11 years ago
|
||
m1, do you know if this should be a 1.3 blocker? This basically lets us use newer camera hals. We still work with camera hals that use the older api.
Flags: needinfo?(mvines)
Updated•11 years ago
|
Attachment #829518 -
Flags: review?(mh+mozilla) → review+
Assignee | ||
Comment 17•11 years ago
|
||
(In reply to Michael Wu [:mwu] from comment #13)
> Comment on attachment 829520 [details] [diff] [review]
> patch part 3 - Instantiate and register FakeSurfaceComposer
>
> Review of attachment 829520 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: widget/gonk/nsAppShell.cpp
> @@ +745,5 @@
> > #endif
> > +#if ANDROID_VERSION >= 18
> > + if (XRE_GetProcessType() == GeckoProcessType_Default) {
> > + android::FakeSurfaceComposer::instantiate();
> > + }
>
> Can you clean this up a little bit while you're at it? Combine this if block
> into the one above it, and make sure they both use 4 space indents instead
> of the broken indentation we currently have.
I am going to apply it to next patch.
Assignee | ||
Comment 18•11 years ago
|
||
(In reply to Michael Wu [:mwu] from comment #14)
> Comment on attachment 829517 [details] [diff] [review]
> patch part 1 - Add FakeSurfaceComposer
>
> Review of attachment 829517 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: widget/gonk/nativewindow/FakeSurfaceComposer.cpp
> @@ +58,5 @@
> > +}
> > +
> > +/* static */
> > +void FakeSurfaceComposer::instantiate() {
> > + waitServiceManager();
>
> Do we need this? I don't really see examples of code spinning in a loop
> waiting for the service manager.
It is not necessary. I am going to remove it in next patch. It is copied from MediaResourceManagerService's implementation. When I wrote it, I just added it for protection. But service manager always start as a first service. So, it is not necessary. I am going to remove it in next patch and also remove MediaResourceManagerService's one in a new bug.
>
> @@ +59,5 @@
> > +
> > +/* static */
> > +void FakeSurfaceComposer::instantiate() {
> > + waitServiceManager();
> > + waitBeforeAdding( android::String16("SurfaceFlinger") );
>
> On a normal B2G phone, the only process that would claim to be
> SurfaceFlinger should be this process, since the surfaceflinger binary
> shouldn't be installed. Does this cover the possibility that the service
> manager doesn't remove the service quickly enough if we crash?
Yes, I intended for it. But it seems not necessary. I see it only on ice codeaurora's code. I am going to remove it in next patch.
https://www.codeaurora.org/cgit/external/gigabyte/platform/frameworks/base/tree/media/mediaserver/main_mediaserver.cpp?h=caf/b2g_ics_1.2#n38
Assignee | ||
Comment 19•11 years ago
|
||
On nexus-4, the services were started like following order.
-> starting 'servicemanager'
-> starting 'vold'
-> starting 'kickstart'
-> starting 'netd'
-> starting 'debuggerd'
-> starting 'ril-daemon'
-> starting 'drm'
-> starting 'media'
-> starting 'installd'
-> starting 'keystore'
-> starting 'fakeperm'
-> starting 'fakesched'
-> starting 'fakeappops'
-> starting 'b2g'
-> starting 'rilproxy'
-> starting 'nfcd'
-> starting 'OOMLogger'
-> starting 'rmt_storage'
-> starting 'bridgemgrd'
-> starting 'qmuxd'
-> starting 'netmgrd'
-> starting 'thermald'
-> starting 'mpdecision'
-> starting 'bdAddrLoader'
Assignee | ||
Comment 20•11 years ago
|
||
Apply the comment. Carry 'mwu=review+'.
Attachment #829520 -
Attachment is obsolete: true
Attachment #8333636 -
Flags: review+
Assignee | ||
Comment 21•11 years ago
|
||
Apply the comment. Confirmed the patch works on nexus7(flo).
Attachment #829517 -
Attachment is obsolete: true
Attachment #829517 -
Flags: review?(mwu)
Assignee | ||
Updated•11 years ago
|
Attachment #8333658 -
Flags: review?(mwu)
Comment 22•11 years ago
|
||
Comment on attachment 8333658 [details] [diff] [review]
patch part 1 v2 - Add FakeSurfaceComposer
Review of attachment 8333658 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good - thanks!
::: widget/gonk/nativewindow/FakeSurfaceComposer.cpp
@@ +29,5 @@
> +
> +/* static */
> +void FakeSurfaceComposer::instantiate() {
> + defaultServiceManager()->addService(
> + String16("SurfaceFlinger"), new FakeSurfaceComposer());
nit: fix indentation here.
@@ +43,5 @@
> +}
> +
> +sp<ISurfaceComposerClient> FakeSurfaceComposer::createConnection()
> +{
> + return NULL;
nit: use nullptr, assuming it works.
Attachment #8333658 -
Flags: review?(mwu) → review+
Comment 23•11 years ago
|
||
Comment on attachment 829524 [details] [diff] [review]
patch part 4 - Remove MaxAcquiredBufferCount limitation from GonkBufferQueue
Review of attachment 829524 [details] [diff] [review]:
-----------------------------------------------------------------
Can we change http://hg.mozilla.org/mozilla-central/file/c335eaa4494a/widget/gonk/nativewindow/GonkNativeWindowJB.cpp#l39 from MIN_UNDEQUEUED_BUFFERS to MAX_MAX_ACQUIRED_BUFFERS instead?
Assignee | ||
Comment 24•11 years ago
|
||
(In reply to Michael Wu [:mwu] from comment #23)
> Comment on attachment 829524 [details] [diff] [review]
> patch part 4 - Remove MaxAcquiredBufferCount limitation from GonkBufferQueue
>
> Review of attachment 829524 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Can we change
> http://hg.mozilla.org/mozilla-central/file/c335eaa4494a/widget/gonk/
> nativewindow/GonkNativeWindowJB.cpp#l39 from MIN_UNDEQUEUED_BUFFERS to
> MAX_MAX_ACQUIRED_BUFFERS instead?
Yeah, it is better solution. It should work. I am going to update the patch.
Assignee | ||
Comment 25•11 years ago
|
||
Apply the comment.
Attachment #829524 -
Attachment is obsolete: true
Attachment #829524 -
Flags: review?(mwu)
Comment 26•11 years ago
|
||
Comment on attachment 8335107 [details] [diff] [review]
patch part 4 ver2 - Remove MaxAcquiredBufferCount limitation from GonkBufferQueue
r=me, assuming you want this reviewed and the patch worked for you.
Attachment #8335107 -
Flags: review+
Assignee | ||
Comment 27•11 years ago
|
||
(In reply to Michael Wu [:mwu] from comment #26)
> Comment on attachment 8335107 [details] [diff] [review]
> patch part 4 ver2 - Remove MaxAcquiredBufferCount limitation from
> GonkBufferQueue
>
> r=me, assuming you want this reviewed and the patch worked for you.
Thanks! I just thought to confirm the patches before asking to review.
Assignee | ||
Comment 28•11 years ago
|
||
(In reply to Michael Wu [:mwu] from comment #23)
>
> Can we change
> http://hg.mozilla.org/mozilla-central/file/c335eaa4494a/widget/gonk/
> nativewindow/GonkNativeWindowJB.cpp#l39 from MIN_UNDEQUEUED_BUFFERS to
> MAX_MAX_ACQUIRED_BUFFERS instead?
Oh, I misunderstood about it. The value set by GonkBufferQueue::setMaxAcquiredBufferCount()is used as MinUndequeuedBufferCount. GonkBufferQueue is allocate 'MinUndequeuedBufferCount + "number of buffers requested from ANativeWindow's client"' number of buffers. So, change to MAX_MAX_ACQUIRED_BUFFERS means to allocate more than 30 buffers. For the time being, there is no big necessity to increase MinUndequeuedBufferCount. I am going to drop part 4 patch.
Assignee | ||
Comment 29•11 years ago
|
||
Comment on attachment 8335107 [details] [diff] [review]
patch part 4 ver2 - Remove MaxAcquiredBufferCount limitation from GonkBufferQueue
part 4 became not ncecessary.
Attachment #8335107 -
Attachment is obsolete: true
Assignee | ||
Comment 30•11 years ago
|
||
Assignee | ||
Comment 31•11 years ago
|
||
Attachment #829518 -
Attachment is obsolete: true
Attachment #829525 -
Attachment is obsolete: true
Attachment #8333636 -
Attachment is obsolete: true
Attachment #8333658 -
Attachment is obsolete: true
Attachment #8336196 -
Flags: review+
Assignee | ||
Comment 32•11 years ago
|
||
Fix nit.
Attachment #8336196 -
Attachment is obsolete: true
Attachment #8336205 -
Flags: review+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 33•11 years ago
|
||
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.3 Sprint 5 - 11/22
You need to log in
before you can comment on or make changes to this bug.
Description
•