For most of interlace output camera sensors, they only support up to 30fps sample rate. In this case, we may not get good display quality. In order to improve the permance under this case, we can use IPU VDI function to increase the output frequency to be 60fps and then we can get a better quality. The patch is an example to support YUV422(YUYV) 60fps VDI for Android camera preview.
SW Platform:
kk4.4.2_1.0.0-ga
HW Platform:
imx6q-sabresd
Features:
Patch:
The linux kernel patch to support additonal IPU function can be found at:
https://community.freescale.com/docs/DOC-173003
The Android Camera HAL can be found at here.
Note:
1. The g_vdi_double is used to decide whether to support these features. When g_vdi_double is set to be 1, these features will be enabled; Or these features will be disabled and camera feature will be the same with default release.
2. The patch should be used at hardware\imx\mx6\libcamera2.
3. Accoeding to the real user case, the user can set IPU VDI motion mode to be 0 or 1 , but NEVER to be 2.
4. The fps can be up to 60fps, but it is not stable now.
Hi Tony, I applied your patch to kk4.4.2_1.0.0-ga, built it, but met errors, can you update?
hardware/imx/mx6/libcamera2/DeviceAdapter.cpp: In member function 'int DeviceAdapter::deviceThread()':
hardware/imx/mx6/libcamera2/DeviceAdapter.cpp:733:29: error: 'struct ipu_deinterlace' has no member named 'vdi_2odd'
hardware/imx/mx6/libcamera2/DeviceAdapter.cpp:780:29: error: 'struct ipu_deinterlace' has no member named 'vdi_2odd'
make: *** [out/target/product/sabresd_6dq/obj/SHARED_LIBRARIES/camera.imx6_intermediates/DeviceAdapter.o] Error 1
After Merged this patch in Android4.4.3, imx6dl, we meet some errors and the camera preview get stucks:
I/FslCameraHAL( 156): RequestManager int RequestManager::registerStreamBuffers(__u32, int, const native_handle_t**) end...
I/FslCameraHAL( 156): RequestManager int RequestManager::allocateStream(__u32, __u32, int, const camera2_stream_ops_t*, __u32*, __u32*, __u32*, __u32*)...
I/FslCameraHAL( 156): int RequestManager::allocateStream(__u32, __u32, int, const camera2_stream_ops_t*, __u32*, __u32*, __u32*, __u32*) jpeg stream, w:960, h:480, fmt:0x21
I/FslCameraHAL( 156): actual format 0x103
I/FslCameraHAL( 156): RequestManager int RequestManager::allocateStream(__u32, __u32, int, const camera2_stream_ops_t*, __u32*, __u32*, __u32*, __u32*) end...
I/FslCameraHAL( 156): RequestManager int RequestManager::registerStreamBuffers(__u32, int, const native_handle_t**) stream id:3
I/FslCameraHAL( 156): RequestManager int RequestManager::registerStreamBuffers(__u32, int, const native_handle_t**) end...
I/FslCameraHAL( 156): DEBUG(int RequestManager::CreateDefaultRequest(int, camera_metadata_t**)): making template (1)
I/FslCameraHAL( 156): int CameraHal::notify_request_queue_not_empty() running
I/FslCameraHAL( 156): int RequestManager::dispatchRequest() running
I/FslCameraHAL( 156): bool RequestManager::handleRequest() running
I/FslCameraHAL( 156): bool RequestManager::handleRequest():Dequeue request
I/FslCameraHAL( 156): android::status_t MetadaManager::getRequestType(int*) request type preview
I/FslCameraHAL( 156): bool RequestManager::handleRequest():start request 1
I/FslCameraHAL( 156): int RequestManager::tryRestartStreams(int) running
I/FslCameraHAL( 156): PreviewStream virtual int PreviewStream::configure(int, bool) running
I/FslCameraHAL( 156): pixel format: 0x3231564e
E/FslCameraHAL( 156): Width * Height 960 x 480 format 0x3231564e, fps: 15
I/FslCameraHAL( 156): PreviewStream virtual int PreviewStream::start() running
I/FslCameraHAL( 156): StreamAdapter virtual int StreamAdapter::start() running
I/FslCameraHAL( 156): stream thread received STREAM_START command
I/FslCameraHAL( 156): Created device thread
I/FslCameraHAL( 156): bool RequestManager::handleRequest():Completed request 1
I/FslCameraHAL( 156): bool RequestManager::handleRequest():Dequeue request
I/FslCameraHAL( 156): android::status_t MetadaManager::getRequestType(int*) request type preview
I/FslCameraHAL( 156): bool RequestManager::handleRequest():start request 1
I/FslCameraHAL( 156): int RequestManager::tryRestartStreams(int) running
I/FslCameraHAL( 156): sleep time 11890 us
I/FslCameraHAL( 156): bool RequestManager::handleRequest():Completed request 1
I/FslCameraHAL( 156): bool RequestManager::handleRequest():Dequeue request
I/FslCameraHAL( 156): android::status_t MetadaManager::getRequestType(int*) request type preview
I/FslCameraHAL( 156): bool RequestManager::handleRequest():start request 1
I/FslCameraHAL( 156): int RequestManager::tryRestartStreams(int) running
I/FslCameraHAL( 156): sleep time 5302 us
E/BufferQueue( 1059): [unnamed-1059-5] queueBuffer: slot 4 is not owned by the client (state=0)
E/Surface ( 156): queueBuffer: error queuing buffer to SurfaceTexture, -22
E/Camera2-Device( 156): static int android::Camera2Device::StreamAdapter::enqueue_buffer(const camera2_stream_ops_t*, __s64, const native_handle_t**): Error queueing buffer to native window: Invalid argument (-22)
E/FslCameraHAL( 156): Surface::queueBuffer returned error -22, phyAddr 0x286f8400, mBufHandle 0xb8ad22c8, mBindUVCBufIdx -1
E/FslCameraHAL( 156): virtual int PreviewStream::processFrame(CameraFrame*) renderBuffer failed, state 16
E/BufferQueue( 1059): [unnamed-1059-5] cancelBuffer: slot 4 is not owned by the client (state=0)
E/FslCameraHAL( 156): virtual void CameraHal::handleError(int) handle error:-22
E/Camera2ClientBase( 156): Error condition -22 reported by HAL, arguments 0, 0
Could you please help check?
Thanks.