Jump to content


Photo

a way to cleanly integrate u8220 eclair libcamera.so into froyo

* * * * * 3 votes

  • Please log in to reply
48 replies to this topic

#1
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts
EDIT: For those that are not interested in technical discussions, just have a look at the new CM7.2 ROM that features my camera work among various improvements from other contributors

old post:

Most of you know that we have a working camera with CM6 (froyo) ROMs. Some of you also know that, in theory, a camera lib that works on froyo can be used for gingerbread as well - because CM7 has a built-in wrapper to allow the use of froyo compatible libcamera binaries.

Now, so why does the pulse have a camera in froyo and not in gingerbread? The answer is simple: our libcamera isn't froyo compatible. There were two major changes between eclair and froyo:
  • libui was split into libui, libcamera_client and libsurfaceflinger_client
  • components inside libbinder ("MemoryDealer" and others) were modified and expose a slightly different API
Both changes affect libcamera. First it is unable to resolve all dependencies because it was only linked to libui. It misses things that now reside in libcamera_client. Additionally, even if the dependency issue is resolved by some wrapper, libcamera will crash because it fails to allocate memory correctly.

In CM6, the camera only works because all above mentioned changes (eclair -> froyo) have been reverted when compiling CM6 for the pulse. The libui of CM6 (for the pulse, not in general!) is merged again with libcamera_client. Therefore, you won't find libcamera_client.so in a pulse CM6 ROM. Also, libbinder is modified to use eclair MemoryDealer. As a consequence, any library that depends on either libbinder, libui, libcamera_client or libsurfaceflinger_client is different in pulse-CM6 compared to any other CM6 build.


I followed an alternative approach: instead of patching the CM source to work with an old binary, I hexedited the binary to load an additional library. This additional library ("camera.so") contains wrappers for libbinder and libcamera_client.

The combination of hexedited "libcamera.so" and helper library "camera.so" integrates into an existing ROM like a normal froyo compatible libcamera.

It should therefore work on any froyo ROM, or on any non-froyo ROMs that require a froyo libcamera.


Anyone wants to know what happens when placing those two small files into a CM7 ROM? Be prepared... ;)

Edited by dr.flo, 24 January 2012 - 07:55 AM.

  • 2

#2
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts
Status: Functionality of the wrapper

#1
ROM: CM7.2 (the one from this post) with kernel .29
photo: no issues known (have taken about 20 3MP pictures in a row)
video: locks up when trying to save the recording. Low quality recordings work.

#2
ROM: CM7.1 (dtox125 old version august 2011) with kernel .29
photo: same as #1
video: same as #1

#3
ROM: u8150-froyo (pier11 reference rom) with kernel exchanged to .32 compat kernel
photo: same as #1
video: no recording possible at all. logcat suggests video encoder component VENC_OMX doesn't run. Maybe an issue with this specific rom (audio is also broken there)

#4
ROM: stock eclair 2.1 (with modified wrapper that links to libui instead of libcamera.so; just to test libbinder part of the wrapper)
photo: no issues
video: no issues

#5
ROM: CM6 TXG mod (with modified wrapper that links to libui instead of libcamera.so; just to test libbinder part of the wrapper)
photo: no issues
video: no issues

#6 - reported by pier11
ROM: CM7.2 dtox new with kernel .32 compat
photo: no issues
video: same as #1

#7
ROM: CM6 clean (rebuilt from source without BOARD_USES_ELCAIR_LIBCAMERA, therefore normal froyo libcamera_client, libsurfacfinger_client and MemoryDealer)
photo: no issues
video: no issues


Several users have reported the video issue to dissappear after a reboot. I could not yet verify this. For me, even after a reboot, video on high quality still locks up.

Zoom is not available, seems to be implemented vendor specific in eclair. No fix possible for this. There is also no zoom in our current CM6.


The wrapped parts (MemoryHeapPmem, which is 1:1 identical in froyo and gingerbread; CameraParameters which is damn simple) do not seem to cause the HQ video recording issues. Otherwise they would be present on rom #7 as well.

I consider the work on this wrapper as finished.

Additional note on video: With ROM #1, you may want to try lgCamera or similar apps. lgCamera managed to record H.263 in 430x320 (this is what HQ would be in built-in camera app) without issues.

Edited by dr.flo, 23 January 2012 - 08:12 PM.

  • 1

#3
peelie

peelie

    Enthusiast

  • Members
  • PipPipPip
  • 218 posts
wow so camera works now? is this with pier's .32 kernel?

edit

woot camera works!

but video capture force closes after trying to save recording

fyi the rom is using .29 kernel

good work dr flo!

Edited by peelie, 22 January 2012 - 11:10 PM.

  • 0

#4
jafp

jafp

    Regular

  • Members
  • PipPip
  • 57 posts
  • Gender:Not Telling
  • Location:Portugal
  • Devices:TMN a1 (Huawei U8230)
This is unbelievable! This is a dream! I have no words :rolleyes:

Thank you very much!!!

  • 0

#5
pier11

pier11

    Addict

  • Members
  • PipPipPipPipPip
  • 883 posts
  • Gender:Male
  • Location:New York, USA
  • Devices:T-Mobile Pulse U8220
you are the man!
we waited for you for so long :)
/yet to test myself/

  • 0

#6
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts

...
but video capture force closes after trying to save recording

fyi the rom is using .29 kernel


The ROM uses .29 kernel because libcamera needs the old camera interface. But since pier11 also has a version of .32 kernel which exposes the old camera interface, we are not stuck with the old kernel. For testing things, though, I think the old kernel is fine right now.

I can confirm the freezing issue after video recording. For me, although it crashes, it looks like the video is saved to the sd card (DCIM folder). I will do some further tests when I have time. But I don't expect an easy solution.:(

  • 0

#7
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts
Have you tried changing the quality settings? For me, video recording doesn't lock up if I select low quality or MMS quality. High quality and YouTube make video recording crash.
Can anyone confirm?

I'm not quite sure yet if this issue is really related to the wrapper. I will do some further tests during the day... (e.g. test the wrapper on a froyo rom)

  • 0

#8
hzf

hzf

    Regular

  • Members
  • PipPip
  • 61 posts
  • Gender:Male
  • Interests:Installing a Custom ROM:
    1. BACKUP
    2. FACTORY RESET
    (OPTIONAL: FORMAT /BOOT , /SYSTEM )
    3. INSTALL ZIP FROM SD CARD
    (OPTIONAL: INSTALL GAPPS)
  • Devices:Huawei RBM2, Galaxy Nexus
GREAT JOB!!!!

  • 0
Any suggestions I make are just that, suggestions. I am not responsible for what you do to your phone.

#9
desalesouche

desalesouche

    Addict

  • Members
  • PipPipPipPipPip
  • 666 posts
  • Gender:Male
  • Devices:u8230/u8860
hello .do i install this rom with gapps 20110613 and also dtapps2sd 2.7.5.2....thx...

Edited by desalesouche, 23 January 2012 - 12:42 PM.

  • 0

#10
lloco73

lloco73

    Regular

  • Members
  • PipPip
  • 128 posts
  • Gender:Male
  • Location:Portugal
  • Devices:ZTE Blade (sapo a5)
fast test on u8230.

photos are ok. on video when selected high quality app stopped responding. rebooted and tested again and it recorded on high res. only prob is that zoom buttons do not work.

  • 0

#11
jafp

jafp

    Regular

  • Members
  • PipPip
  • 57 posts
  • Gender:Not Telling
  • Location:Portugal
  • Devices:TMN a1 (Huawei U8230)

fast test on u8230.

photos are ok. on video when selected high quality app stopped responding. rebooted and tested again and it recorded on high res. only prob is that zoom buttons do not work.



I have the same result, the video problem only hapens the first time, reboot the phone and now i am able to make video.
This is amazing! We have been waiting for this so mutch time.
Great job!

  • 0

#12
pier11

pier11

    Addict

  • Members
  • PipPipPipPipPip
  • 883 posts
  • Gender:Male
  • Location:New York, USA
  • Devices:T-Mobile Pulse U8220

I have the same result, the video problem only hapens the first time, reboot the phone and now i am able to make video.
This is amazing! We have been waiting for this so mutch time.
Great job!

I can confirm above.
Video starts work after reboot. First time it didn't work.

I test on dtox's 7.2 compiled against 2.6.32 kernel.
Just updated 3 libs from your upload.

Awesome work, man!!

(though still keep wanting crack msm7225 froyo camera libs to pave a way to msm7227 gingerbread libs, to ics?...)

Edited by pier11, 23 January 2012 - 01:26 PM.

  • 0

#13
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts
This means dtox compiled the kernel from compat-branch. I didn't know that, thought that ROM would have new camera API, otherwise I would have used that ROM for the tests.

To all who gave feedback. Thanks for testing. I'll add this to my status list in post two.

Regarding ZOOM not working. I don't know - does the pulse support Zoom at all? Is it supported in stock 2.1 roms? Anyways it would just be "software zoom" which is of no value. It only means cropping the recording area. No real optical zoom.

@pier11: I agree that on the long term, having the newer libs running would be a better approach. Especially a native gingerbread lib would be fine. With the current solution, we need to compile gingerbread with BOARD_USE_FROYO_LIBCAMERA - luckily this influences only libcameraservice, because the differences between froyo and gingerbread are quite small.

  • 0

#14
pier11

pier11

    Addict

  • Members
  • PipPipPipPipPip
  • 883 posts
  • Gender:Male
  • Location:New York, USA
  • Devices:T-Mobile Pulse U8220

This means dtox compiled the kernel from compat-branch. I didn't know that, thought that ROM would have new camera API, otherwise I would have used that ROM for the tests.

He did in fact.

But I tested it with my freshly compiled kernel form compat branch. (Testing my wifi re-integration among other things).

  • 0

#15
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts
To those that can record HQ video after a reboot: I could not reproduce that...

  • if you used the rom download linked in this thread: did you change any settings in the ROM (cyanogenmod settings / swap / compache / VM size / JIT etc / overclock )
  • what camera sensor do you have - just look at the shape of the camera sensor, see this post ?????

my sensor is mt9t013, maybe all of you that can record video have a OV3647 like pier11?

Edited by dr.flo, 23 January 2012 - 02:44 PM.

  • 0

#16
lloco73

lloco73

    Regular

  • Members
  • PipPip
  • 128 posts
  • Gender:Male
  • Location:Portugal
  • Devices:ZTE Blade (sapo a5)

To those that can record HQ video after a reboot: I could not reproduce that...

  • if you used the rom download linked in this thread: did you change any settings in the ROM (cyanogenmod settings / swap / compache / VM size / JIT etc / overclock )
my sensor is mt9t013, maybe all of you that can record video have a OV3647 like pier11?



for me just a fresh install withou any changes to the ROM

...

  • what camera sensor do you have - just look at the shape of the camera sensor, see this post ?????
my sensor is mt9t013, maybe all of you that can record video have a OV3647 like pier11?


Just reloaded stock rom and here are the details:
touch screen type: synaptics-rmi-touchscreen
External camera type: mt9t013_byd
Internal camera type:ov7690

Edited by lloco73, 23 January 2012 - 02:58 PM.

  • 0

#17
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts

for me just a fresh install withou any changes to the ROM



Just reloaded stock rom and here are the details:
touch screen type: synaptics-rmi-touchscreen
External camera type: mt9t013_byd
Internal camera type:ov7690


thanks for doing this detailed testing... While you're on stock rom - can you check if it features zoom? I don't remember - never used it....
Seems you have my hardware. I'm still wondering.... HQ video still working for you?

It worked for me once or twice, but normally it crashes... Anyone that said HQ video is working - is it still working?

  • 0

#18
lloco73

lloco73

    Regular

  • Members
  • PipPip
  • 128 posts
  • Gender:Male
  • Location:Portugal
  • Devices:ZTE Blade (sapo a5)

thanks for doing this detailed testing... While you're on stock rom - can you check if it features zoom? I don't remember - never used it....
Seems you have my hardware. I'm still wondering.... HQ video still working for you?

It worked for me once or twice, but normally it crashes... Anyone that said HQ video is working - is it still working?


Sorry just return to FLB
on FLB1.7 zoom works and does not crashes.

  • 0

#19
dr.flo

dr.flo

    Diehard

  • Members
  • PipPipPipPip
  • 429 posts

Sorry just return to FLB
on FLB1.7 zoom works and does not crashes.

no problem. afaik FLB is based on eclair... should be "stock" regarding camera.

  • 0

#20
pier11

pier11

    Addict

  • Members
  • PipPipPipPipPip
  • 883 posts
  • Gender:Male
  • Location:New York, USA
  • Devices:T-Mobile Pulse U8220

It worked for me once or twice, but normally it crashes... Anyone that said HQ video is working - is it still working?

not to worry - video hung again :) But phone restored by itself after some time.
Video got recorded fine though.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users