delay in camera capture with imx8mm

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

delay in camera capture with imx8mm

955 Views
ashikp6
Contributor I

Hi,

We are using the imx8mm with our custom board loaded with Android 11. Also added ov5640 camera support.

csi_mclk: csi-mclk {
        compatible = "pwm-clock";
        #clock-cells = <0>;
        clock-frequency = <20000000>;
        clock-output-names = "csi_mclk";
        pwms = <&pwm4 0 50>; /* 1 / 50 ns = 20 MHz */
};
&i2c4c {
        ov5640-mipi1@3c {
                AVDD-supply = <&reg_ldo3>;
                DOVDD-supply = <&reg_vref_1v8>;
                DVDD-supply = <&reg_vref_3v3>;
                clocks = <&csi_mclk>;
                clock-names = "xclk";
                compatible = "ovti,ov5640_mipisubdev";
                csi_id = <0>;
                mclk = <20000000>;
                mipi_csi;
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_i2c4_ov5640_mipi>;
                powerdown-gpios = GP_OV5640_MIPI_POWER_DOWN;
                reg = <0x3c>;
                reset-gpios = GP_OV5640_MIPI_RESET;
                status = "okay";

                port {
                        ov5640_mipi1_ep: endpoint {
                                remote-endpoint = <&mipi1_ov5640_ep>;
                        };
                };
        };
};
&mipi_csi_1 {
    #address-cells = <1>;
    #size-cells = <0>;
    status = "okay";
    port {
        mipi1_ov5640_ep: endpoint@1 {
            remote-endpoint = <&ov5640_mipi1_ep>;
            data-lanes = <2>;
            csis-hs-settle = <13>;
            csis-clk-settle = <2>;
            csis-wclk;
        };

        csi1_mipi_ep: endpoint@2 {
            remote-endpoint = <&csi1_ep>;
        };
    };
};
&csi1_bridge {
    fsl,mipi-mode;
    status = "okay";

    port {
        csi1_ep: endpoint {
            remote-endpoint = <&csi1_mipi_ep>;
        };
    };
};



We are facing an issue while capturing a 5mp image with ov5640. We have observed a delay of 1s between the time the capture button clicked vs the image capture happened. Hence the frames that we got are different from what we wanted.

 

10-11 11:15:08.384  2933  2933 D CAM_LcyLocProvider: No location received yet.
10-11 11:15:08.401  2933  3005 D CAM_CommandExecutor: Executing command: PictureTakerCommand{command=com.android.camera.one.v2.photo.SimpleImageCaptureCommand@1c64da7} START
10-11 11:15:08.411  2933  2933 V CAM_CameraActivity: onSessionQueued: camera_session://google.com/4c388a54-1251-4620-beed-53eaa1b909a5
10-11 11:15:08.414  2933  2933 V CAM_FilmstripView: suggesting item bounds: 640x886
10-11 11:15:08.415  2933  2933 V CAM_FilmstripView: getRecycledView, recycled=false
10-11 11:15:08.419  2933  2933 V CAM_FilmstripView: recycleView
10-11 11:15:08.421  2933  2933 I CAM_FilmstripView: [ViewItem:0] mData.renderThumbnail()
10-11 11:15:08.422  2933  2933 D CAM_FilmstripView: onFilmstripItemInserted()
10-11 11:15:08.447   415   452 I gralloc_driver: is_supported check descriptor name=ImageReader-2592x1944f100m15-2933-0, width=8388608, height=1, droid_format=BLOB, usage=CAMERA_OUTPUT|CPU_READ_OFTEN|GPU_RE
10-11 11:15:08.482   412  1813 I CameraDeviceSessionHwlImpl: PickConfigStream: previewIdx 1, callbackIdx -1, stillcapIdx 0, recordIdx -1, intent 2
10-11 11:15:08.482   412  1813 I CameraDeviceSessionHwlImpl: choose stream index 0 as config stream
---------diff--------
10-11 11:15:08.482   412  1813 I MMAPStream: onDeviceStopLocked
10-11 11:15:08.484   412  1813 I MMAPStream: onDeviceConfigureLocked
10-11 11:15:08.484   412  1813 I MMAPStream: onDeviceConfigureLocked, Width * Height 2592 x 1944 format YUYV, fps: 30, capturemode 5
----------------------
10-11 11:15:08.940   412  1813 I VideoStream: postConfigure, set omit frames 2 for 2592x1944
---------diff--------
10-11 11:15:08.940   412  1813 I MMAPStream: onDeviceStartLocked
10-11 11:15:08.954   412  1813 I MMAPStream: onDeviceStartLocked, register buffer, phy 0x94200000, virt 0xf5733b42a000, size 10077696
10-11 11:15:08.960   412  1813 I MMAPStream: onDeviceStartLocked, register buffer, phy 0x94c00000, virt 0xf5733aa8d000, size 10077696
10-11 11:15:08.960   412  1813 I MMAPStream: onDeviceStartLocked VIDIOC_QBUF phy:0x94200000
10-11 11:15:08.960   412  1813 I MMAPStream: onDeviceStartLocked VIDIOC_QBUF phy:0x94c00000
----------------------
10-11 11:15:08.997   585  1298 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
10-11 11:15:08.998   585  1011 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
10-11 11:15:08.999   429  2714 D AF::TrackHandle: OpPlayAudio: track:63 usage:13 not muted
10-11 11:15:09.001  2933  2933 I AudioTrack: createTrack_l(0): AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 20073
10-11 11:15:09.001   585  1011 I system_server: oneway function 	results will be dropped but finished with status OK and parcel size 8
10-11 11:15:09.004   585  1011 I system_server: oneway function results will be dropped but finished with status OK and parcel size 4
10-11 11:15:09.005   406  1238 W audio_hw_primary: ret -32, pcm write 768 error wait error: hw 0xdec0 app 0xe4c0 avail 0x0
10-11 11:15:09.005   406  1238 W audio_hw_primary: : Broken pipe
---------diff--------
10-11 11:15:09.147   412  2997 I MMAPStream: onFrameAcquireLocked omit frame
10-11 11:15:09.214   412  2997 I MMAPStream: onFrameAcquireLocked omit frame
----------------------
10-11 11:15:09.348   412  2997 E CameraUtils: Error: getSizeByForamtRes format 0x21 not supported
10-11 11:15:09.349   412  2997 E JpegBuilder: Invalid GPS coordinate
10-11 11:15:09.349   412  2997 E JpegBuilder: Invalid GPS coordinate
10-11 11:15:09.349   412  2997 E CameraMetadata: Get: error reading tag
10-11 11:15:09.349   412  2997 E CameraMetadata: Get: error reading tag
10-11 11:15:09.548   412  2997 I CameraDeviceSessionHwlImpl: processJpegBuffer, dstbuf size 8388608, 10119168, jpeg_size 3550669, max jpeg size 8388608
10-11 11:15:09.553   412   412 I CameraDeviceSessionHwlImpl: PickConfigStream: previewIdx 1, callbackIdx -1, stillcapIdx 0, recordIdx -1, intent 1
10-11 11:15:09.553   412   412 I CameraDeviceSessionHwlImpl: choose stream index 1 as config stream
---------diff---------
10-11 11:15:09.554   412   412 I MMAPStream: onDeviceStopLocked
10-11 11:15:09.560   412   412 I MMAPStream: onDeviceConfigureLocked
10-11 11:15:09.560   412   412 I MMAPStream: onDeviceConfigureLocked, Width * Height 640 x 480 format YUYV, fps: 30, capturemode 0
-----------------------
10-11 11:15:09.561  2933  2933 V CAM_CaptureModule: AF status is state:INACTIVE
---------diff---------
10-11 11:15:09.760   412   412 I MMAPStream: onDeviceStartLocked
10-11 11:15:09.766   412   412 I MMAPStream: onDeviceStartLocked, register buffer, phy 0x8e600000, virt 0xf5734bf70000, size 614400
10-11 11:15:09.767   412   412 I MMAPStream: onDeviceStartLocked, register buffer, phy 0x8ea00000, virt 0xf57348069000, size 614400
10-11 11:15:09.768   412   412 I MMAPStream: onDeviceStartLocked, register buffer, phy 0x8eb00000, virt 0xf57347fd3000, size 614400
10-11 11:15:09.768   412   412 I MMAPStream: onDeviceStartLocked VIDIOC_QBUF phy:0x8e600000
10-11 11:15:09.768   412   412 I MMAPStream: onDeviceStartLocked VIDIOC_QBUF phy:0x8ea00000
10-11 11:15:09.768   412   412 I MMAPStream: onDeviceStartLocked VIDIOC_QBUF phy:0x8eb00000
-----------------------
10-11 11:15:09.807  2933  3005 D CAM_ProcessingSvcMgr: Task added. Queue size now: 1
10-11 11:15:09.810   585  1011 W ActivityManager: Unable to start service Intent { cmp=com.android.camera2/com.android.camera.processing.ProcessingService } U=0: not found
10-11 11:15:09.811  2933  3005 V CAM_ImageBackend: Received an opened image: 1/0

10-11 11:15:09.811  2933  3005 V CAM_ImageBackend: Setting an image reference count of 1   Total refs = 1
10-11 11:15:09.813  2933  3005 D CAM_CommandExecutor: Executing command: PictureTakerCommand{command=com.android.camera.one.v2.photo.SimpleImageCaptureCommand@1c64da7} END
10-11 11:15:09.838  2933  3013 V CAM_ImageBackend: Ref release.  Total refs = 0
10-11 11:15:09.839  2933  3013 V CAM_ImageBackend: Ref release close.
10-11 11:15:09.839  2933  3014 E ion     : ioctl c0044901 failed with code -1: Inappropriate ioctl for device
10-11 11:15:09.841  2933  3014 V CAM_ImageBackend: Release of image occurred.  Good fun. Total Images Open/Closed = 1/1
10-11 11:15:09.894  2933  2933 V CAM_CaptureModule: AF status is state:PASSIVE_SCAN
10-11 11:15:09.895  2933  2933 V CAM_FocusController: Running showPassiveFocusAtCenter()
10-11 11:15:09.896  2933  2933 I CAM_FocusRingView: Computing center via preview size.
10-11 11:15:09.949     0     0 W healthd : battery l=100 v=4404 t=20.0 h=2 st=5 c=1 chg=a
10-11 11:15:10.040  2933  2952 D CompatibilityChangeReporter: Compat change id reported: 150939131; UID 10098; state: DISABLED
10-11 11:15:10.041  2933  2981 V CAM_CameraDataAdapter: updating media metadata with photos newer than id: 76
10-11 11:15:10.053  1302  2414 W SQLiteQueryBuilder: Allowing abusive custom column: LIKE
10-11 11:15:10.054  1302  2414 W SQLiteQueryBuilder: Allowing abusive custom column: AND
10-11 11:15:10.054  1302  2414 W SQLiteQueryBuilder: Allowing abusive custom column: DESC
10-11 11:15:10.066  2933  2981 W CAM_PhotoDataFact: Zero dimension in ContentResolver for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg:0x0
10-11 11:15:10.069  2933  2981 D skia    : --- Failed to create image decoder with message 'unimplemented'
10-11 11:15:10.090  2933  2981 W CAM_PhotoDataFact: Dimension decode failed for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg
10-11 11:15:10.130  1302  2414 W SQLiteQueryBuilder: Allowing abusive custom column: AND
10-11 11:15:10.130  1302  2414 W SQLiteQueryBuilder: Allowing abusive custom column: IN
10-11 11:15:10.168  2933  3013 D StrictMode: StrictMode policy violation: android.os.strictmode.ContentUriWithoutPermissionViolation: content://media/external/images/media/77 exposed beyond app through Int?
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.os.StrictMode.onContentUriWithoutPermission(StrictMode.java:2149)
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.net.Uri.checkContentUriWithoutPermission(Uri.java:2403)
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.content.Intent.prepareToLeaveProcess(Intent.java:11164)
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.content.Intent.prepareToLeaveProcess(Intent.java:11104)
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1114)
10-11 11:15:10.168  2933  3013 D StrictMode:    at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:468)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.util.CameraUtil.broadcastNewPicture(CameraUtil.java:749)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.session.PlaceholderManager.finishPlaceholder(PlaceholderManager.java:140)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.session.CaptureSessionImpl.saveAndFinish(CaptureSessionImpl.java:322)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.processing.imagebackend.TaskCompressImageToJpeg.run(TaskCompressImageToJpeg.java:344)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.processing.imagebackend.ImageBackend$TaskDoneWrapper.run(ImageBackend.java:829)
10-11 11:15:10.168  2933  3013 D StrictMode:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
10-11 11:15:10.168  2933  3013 D StrictMode:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
10-11 11:15:10.168  2933  3013 D StrictMode:    at java.lang.Thread.run(Thread.java:923)
10-11 11:15:10.168  2933  3013 D StrictMode:    at com.android.camera.async.AndroidPriorityThread.run(AndroidPriorityThread.java:26)
10-11 11:15:10.181  2933  3013 D StrictMode: StrictMode policy violation: android.os.strictmode.ContentUriWithoutPermissionViolation: content://media/external/images/media/77 exposed beyond app through Int?
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.os.StrictMode.onContentUriWithoutPermission(StrictMode.java:2149)
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.net.Uri.checkContentUriWithoutPermission(Uri.java:2403)
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.content.Intent.prepareToLeaveProcess(Intent.java:11164)
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.content.Intent.prepareToLeaveProcess(Intent.java:11104)
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1114)
10-11 11:15:10.181  2933  3013 D StrictMode:    at android.content.ContextWrapper.sendBroadcast(ContextWrapper.java:468)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.util.CameraUtil.broadcastNewPicture(CameraUtil.java:751)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.session.PlaceholderManager.finishPlaceholder(PlaceholderManager.java:140)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.session.CaptureSessionImpl.saveAndFinish(CaptureSessionImpl.java:322)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.processing.imagebackend.TaskCompressImageToJpeg.run(TaskCompressImageToJpeg.java:344)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.processing.imagebackend.ImageBackend$TaskDoneWrapper.run(ImageBackend.java:829)
10-11 11:15:10.181  2933  3013 D StrictMode:    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
10-11 11:15:10.181  2933  3013 D StrictMode:    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
10-11 11:15:10.181  2933  3013 D StrictMode:    at java.lang.Thread.run(Thread.java:923)
10-11 11:15:10.181  2933  3013 D StrictMode:    at com.android.camera.async.AndroidPriorityThread.run(AndroidPriorityThread.java:26)
10-11 11:15:10.193  2933  2933 V CAM_CameraActivity: onSessionDone:camera_session://google.com/4c388a54-1251-4620-beed-53eaa1b909a5
10-11 11:15:10.200  1302  1322 W SQLiteQueryBuilder: Allowing abusive custom column: LIKE
10-11 11:15:10.200  1302  1322 W SQLiteQueryBuilder: Allowing abusive custom column: AND
10-11 11:15:10.200  1302  1322 W SQLiteQueryBuilder: Allowing abusive custom column: DESC
10-11 11:15:10.218   585   638 I DropBoxManagerService: add tag=system_app_strictmode isTagEnabled=true flags=0x2
10-11 11:15:10.231  2933  2933 I CAM_FilmstripView: [ViewItem:0] mData.renderTiny()
10-11 11:15:10.233  2933  2933 V CAM_FilmstripView: updateViewItem() - recycling old data item and setting new
10-11 11:15:10.239  2933  2933 D CAM_FilmstripView: updateViewItem(bufferIndex: 2)
10-11 11:15:10.239  2933  2933 D CAM_FilmstripView: updateViewItem() - mIsUserScrolling: false
10-11 11:15:10.240  2933  2933 D CAM_FilmstripView: updateViewItem() - mController.isScrolling() - false
10-11 11:15:10.240  2933  2933 I CAM_FilmstripView: [ViewItem:0] mData.renderThumbnail()
10-11 11:15:10.263  1302  1322 W MediaProvider: Using FUSE for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg
10-11 11:15:10.266  1302  1347 W SQLiteQueryBuilder: Allowing abusive custom column: AND
10-11 11:15:10.307  1302  1347 W MediaProvider: Using FUSE for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg
10-11 11:15:10.313  1302  2414 W MediaProvider: Using FUSE for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg
10-11 11:15:10.326  1302  1347 W MediaProvider: Using FUSE for /storage/emulated/0/DCIM/Camera/IMG_20221011_111508.jpg

 


But when we change the capture options to .3mp this delay is not seen.
What could be the cause of this issue?

Thanks,
Ashik P.
 
 
0 Kudos
Reply
4 Replies

885 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ashikp6 

I hope you are doing well.
 
Please tell us about the application you have used to capture images and the steps you have followed.
 
Please try using Gstreamer Pipeline (gst-launch-1.0) to capture an image to discard any hardware or driver-related issues .
 
Thanks & Regards
Dhruvit Vasavada
0 Kudos
Reply

717 Views
ashikp6
Contributor I

I am using the AOSP camera application. 

0 Kudos
Reply

902 Views
ashikp6
Contributor I

Hi @Dhruvit 

Made the following changes,

csi_mclk: csi-mclk {
        compatible = "pwm-clock";
        #clock-cells = <0>;
        clock-frequency = <24000000>;
        clock-output-names = "csi_mclk";
        pwms = <&pwm4 0 42>;
...
ov5640-mipi1@3c {
                AVDD-supply = <&reg_ldo3>;
                DOVDD-supply = <&reg_vref_1v8>;
                DVDD-supply = <&reg_vref_3v3>;
                clocks = <&csi_mclk>;
                clock-names = "xclk";
                compatible = "ovti,ov5640_mipisubdev";
                csi_id = <0>;
                mclk = <24000000>;
...


Still observing a delay of 1.5 seconds in capture. same issue is not observed if i capture with 0.9mp or lower
The driver being used is https://github.com/boundarydevices/linux/blob/boundary-android-11.0.0_2.2.0/drivers/media/platform/m...

0 Kudos
Reply

922 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ashikp6,

Please refer to the ov5640_mipi node in the "/arch/arm64/boot/dts/Freescale/imx8mm-evk.dts" as a reference to add ov5640 camera support in Android 11.

Please note that the recommended frequency for the MCLK is 24000000 Hz.

Could you please try with the above-suggested MCLK frequency?

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

 

Thanks & Regards,
Dhruvit.

0 Kudos
Reply