[Galaxy S Plus I9001 Android Development] Christopher83:
Hi Xistance,

thank you very much for your post...

Yes, as you and Smeroni said, thanks to the closed sources policy for some proprietary libs, the camera stuff is a mess.

Now I'd like to clarify better for all what has been done and the current status...

The work on ION rom started at the end of July and, despite the holidays and work commitments, after some weeks (in the mid of August) we got an almost complete working system.

During those days, we ported and experimented on 3 new kernel branches (based on jb-2.5.3, jb-2.5.5 and jb-2.6 CAF branches) more updated (at that time) and suitable for ION memory allocation and new Adreno drivers, then chose the one that works better (jb-2.5.5 branch), solved the not working deep sleep, some memory allocation and vsync problems and so on...

On rom side we switched to display-caf and media-caf repos, instead of legacy ones, made the needed adaptations on device tree and experimented both new Adreno drivers releases (MR1 and Vanilla, finally we chose Vanilla because works really good for us) and solved the various problems encountered.

When the rom (without camera support) seemed to be stable and to work as usual we begun to experiment on camera stuff, and the long, winding and painful road was undertaken.

The lack of source code for proprietary camera libs and the impossibility to use at all the old libcamera.so and liboemcamera.so, since they only support PMEM (hard coded inside them), dramatically slowed down our progress on this project.

Since that time, we created several kernel and device branches to experiment this possible way or that other way.

At the moment there is one of those "experimental solutions" that gave some little results (but is still much work to do).

On kernel side:

- abandoned the old camera/msm sources (taken from stock 2.6 kernel and adapted by Arco and Ivendor to be used with 3.0 and 3.4 kernels) to use the updated sources coming from CAF branch

- reintegrated camera sensor drivers for our devices and oem camera stuff

On rom side:

- created a replacement for old Camera HAL (camera.msm7x30.so and libcamera.so) that uses ION memory allocation

- reimplemented native_ext_sensor_config methods and a first part of the related calls by reverse enginering the old libcamera.so and liboemcamera.so libs with IDA Pro (unfortunately we can use only the disassembly feature)

- created an "extremely experimental" replacement for old liboemcamera.so

- other adaptations needed for our camera stuff

The currently achieved results are (take a look at the attached logcat and dmesg for details):

- when the camera app is opened the flow Camera Service <-> Camera HAL (QualcommCameraHardware and QualcommCamera) <-> liboemcamera (mm-camera and CAM_FD) <-> kernel msm_camera and camera sensors starts working

- the needed ION buffers are allocated (note: the ALOG messages keep the wording "PMEM", but the allocations are ION, eg. do_mmap_ion/do_munmap_ion instead of do_mmap/do_munmap)

- camera parameters are initialized and set before starting preview, also the reimplemented native_ext_sensor_config calls seem to work fine

- camera preview is started

- after some milliseconds a camframe timeout is received

- deinit of camera process and force close of camera app

After several experiments, kernel panics, system hangs, fcs, it's the time for a break from this stuff, since the time is really reduced to few hours and PMEM seems to be still supported on KitKat too. At the moment it's more appropriate to concentrate all our strength and the little time available for CM 11 porting, then we'll probably keep on doing new experiments on this front.

That's all...

Sorry for this long post and for my bad English...