Closed Bug 946241 Opened 11 years ago Closed 11 years ago

[Camera][gonk-kk] Porting GonkCameraHwMgr

Categories

(Firefox OS Graveyard :: General, defect)

x86_64
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:1.4+)

RESOLVED DUPLICATE of bug 959505
1.4 S2 (28feb)
blocking-b2g 1.4+

People

(Reporter: seinlin, Assigned: schiu)

References

Details

(Whiteboard: [CR 608289])

Attachments

(2 files)

GonkCameraHwMgr is compiled failed in gonk-kk.
Blocks: gonk-kk
Assignee: nobody → vliu
Depends on: 959505
Attachment #8359655 - Flags: review?(sotaro.ikeda.g)
Attachment #8359655 - Flags: review?(pchang)
Assignee: vliu → schiu
Due to the interface change of Camera(frameworks/av/include/camera/Camera.h) in KitKat, I seperate the preview target setting function accroding to API version.
I am trying this change but getting the header file not found issue. In file included from /test/moz/B2G/gecko/dom/camera/GonkCameraHwMgr.h:29:0, from /test/moz/B2G/gecko/dom/camera/GonkRecorder.h:21, from /test/moz/B2G/gecko/dom/camera/GonkCameraControl.h:28, from /test/moz/B2G/gecko/dom/camera/GonkCameraHwMgr.cpp:22: ../../dist/include/GonkNativeWindow.h:17:33: fatal error: GonkNativeWindowJB.h: No such file or directory compilation terminated.
Attached patch moz_build.diffSplinter Review
small change in moz.build in natvie window folder to include the header files.
(In reply to vijayanand.hongal from comment #3) > I am trying this change but getting the header file not found issue. > > In file included from /test/moz/B2G/gecko/dom/camera/GonkCameraHwMgr.h:29:0, > from /test/moz/B2G/gecko/dom/camera/GonkRecorder.h:21, > from /test/moz/B2G/gecko/dom/camera/GonkCameraControl.h:28, > from /test/moz/B2G/gecko/dom/camera/GonkCameraHwMgr.cpp:22: > ../../dist/include/GonkNativeWindow.h:17:33: fatal error: > GonkNativeWindowJB.h: No such file or directory > compilation terminated. Please apply the patch of #959505 first, the patch fixed all compilation error above.
Applying the patch from #959505, the build was clean and was able to flash the built image on nexus-4.
Comment on attachment 8359655 [details] [diff] [review] GonkCameraHwMgr.diff Review of attachment 8359655 [details] [diff] [review]: ----------------------------------------------------------------- Looks good.
Attachment #8359655 - Flags: review?(sotaro.ikeda.g) → review+
Attachment #8359655 - Flags: review?(pchang) → review+
should the MOZ_B2G_CAMERA=1 inclusion in /b2g/gecko/configure.in for Android version 19, be added as patch for this bug ? Without this change, the camera did not work, when i tested the image by flashing on nexus-4. --------------------------------- --- a/configure.in +++ b/configure.in @@ -248,7 +248,7 @@ if test -n "$gonkdir" ; then ;; 19) GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include" - + MOZ_B2G_CAMERA=1 ;; *) AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION]) ---------------------------------
I had some conclusions for porting camera on kit-kat. For Nexus-4: With the patches on Bug 595505 and Comment on attachment 8359655 [details] [diff] [review], plus the modifications in below. diff --git a/configure.in b/configure.in index 2fa5df0..58612a8 100644 --- a/configure.in +++ b/configure.in @@ -249,8 +249,11 @@ if test -n "$gonkdir" ; then AC_SUBST(MOZ_OMX_ENCODER) ;; 19) - GONK_INCLUDES="-I$gonkdir/frameworks/native/include" + GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/framew MOZ_NFC=1 + MOZ_OMX_DECODER=1 + MOZ_OMX_ENCODER=1 + MOZ_B2G_CAMERA=1 diff --git a/widget/gonk/nativewindow/FakeSurfaceComposer.cpp b/widget/gonk/nativewindow/FakeSurfaceComposer.cpp index fddd6b9..82297ae 100644 --- a/widget/gonk/nativewindow/FakeSurfaceComposer.cpp +++ b/widget/gonk/nativewindow/FakeSurfaceComposer.cpp @@ -59,6 +59,12 @@ sp<IBinder> FakeSurfaceComposer::createDisplay(const String8& displayName, return nullptr; } +#if ANDROID_VERSION >= 19 +void FakeSurfaceComposer::destroyDisplay(const sp<IBinder>& display) +{ +} +#endif + sp<IBinder> FakeSurfaceComposer::getBuiltInDisplay(int32_t id) { return nullptr; } @@ -91,6 +97,15 @@ status_t FakeSurfaceComposer::captureScreen(const sp<IBinder>& display, return INVALID_OPERATION; } +#if ANDROID_VERSION >= 19 +status_t FakeSurfaceComposer::captureScreen(const sp<IBinder>& display, + const sp<IGraphicBufferProducer>& producer, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) { + return INVALID_OPERATION; +} +#endif + void FakeSurfaceComposer::blank(const sp<IBinder>& display) { } Based on the above, camera can preview and take picture. But for video recording, we also need the patch of bug 910498 for working on video recording. For Nexus-5: The all patches needed by Nexus-4 are also need by Nexus5. Besides these, there is also a patch needed below. diff --git a/widget/gonk/nativewindow/GonkBufferQueue.cpp b/widget/gonk/nativewindow/GonkBufferQueue.cpp index 865cb66..8473683 100755 --- a/widget/gonk/nativewindow/GonkBufferQueue.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueue.cpp @@ -232,6 +232,9 @@ int GonkBufferQueue::query(int what, int* outValue) case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: value = (mQueue.size() >= 2); break; + case NATIVE_WINDOW_CONSUMER_USAGE_BITS: + value = mConsumerUsageBits; + break; default: return BAD_VALUE; } @@ -264,8 +267,13 @@ status_t GonkBufferQueue::requestBuffer(int slot, sp<GraphicBuffer>* buf) { return NO_ERROR; } After that, Camera on Nexus-5 can preview and take picture. But even so, there is still has problem on video recording. The thing is when playing the recorded file, the video got splashing. From log tracking, I found the parameter eColorFormat is different from Nexus-4 Nexus-4 : eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar Nexus-5 : eColorFormat = OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m I tried to find the whole environment and couldn't find anywhere to set this. @mvines, can you help me to figure it out? Thanks
Flags: needinfo?(mvines)
If you take the latest code, the destroyDisplay method is already added. Its only that method should be added under ANDROID_VERSION 19 #if block. +#if ANDROID_VERSION >= 19 +void FakeSurfaceComposer::destroyDisplay(const sp<IBinder>& display) { } +#endif Or Since the method signature has virtual, the dummy/empty definitions in cpp file can be removed. Even for the captureScreen virtual method, since the return statement has INVALID_OPERATION, the code could be as below: +#if ANDROID_VERSION >= 19 status_t FakeSurfaceComposer::captureScreen(const sp<IBinder>& display, const sp<IGraphicBufferProducer>& producer, uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ, bool isCpuConsumer) { return INVALID_OPERATION; } +#endif
Also the usage of flags : + MOZ_OMX_DECODER=1 I have not included in my changes and was still able to capture the photos and preview them. For the video capture, still the patch from bug 910498 needs to used. The changes in configure.in to enable decoder and camera are being updated as per the bug 959505.
(In reply to vijayanand.hongal from comment #11) > Also the usage of flags : > > + MOZ_OMX_DECODER=1 > > > I have not included in my changes and was still able to capture the photos > and preview them. > > For the video capture, still the patch from bug 910498 needs to used. > > The changes in configure.in to enable decoder and camera are being updated > as per the bug 959505. Thanks for the clarification. Actually I didn't too much detail to check every MOZ_OMX_XXX in configure.in. I just move the settings in 17|18) and lets the build pass.
Flags: needinfo?(mvines)
blocking-b2g: --- → 1.4+
Whiteboard: [CR 608289]
Blocks: 976427
Target Milestone: --- → 1.4 S2 (28feb)
Do we need a review on the build config change to move forward and land that?
Flags: needinfo?(vliu)
I think the patch in bug 959505 includes all build config for porting kk. We don't need to review any modification in this bug. Actually I had ever reviewed the build config part. It is fine to me. These build configurations also works for Nexus-4 and Nexus-5 separately.
Flags: needinfo?(vliu)
The bug now can be covered with bug#959505. Hence change the status to duplicated.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: