[WIP] - ICS Camera HAL for 2.6 kernel

Search This thread

rapmv78

Senior Member
May 9, 2010
113
791
I would offer some help, but without source or an answer to the previous question it seems I can't.

Sent from my ADR6400L using Tapatalk

Thanks for the offer ;) Greatly appreciated. The stuff I have to figure out is not really related to the HAL module, as I already have software encoding working. It is w.r.t stagefright hardware encoding support. Anything you can offer in terms of tips from prior experience would go a long way. Sorry, I missed your question earlier. I thought I had posted the reason in the other thread and a smaller version in the first post. But here is the main difference between the other work and the work tracked in this thread. The other work was a complete compile from source code to integrate the source corresponding to libcamera.so and the hal new code requirement in ICS as one HAL module. This thread tracks work to make existing libcamera.so stuff from gingerbread work in binary form, with as little device specific stuff as feasible. That was the reason I had mentioned that this may or may not work with 3.0 kernels as it requires the gingerbread libcamera.so to be compatible with the 3.0 kernel due to the HAL module's hard dependency on libcamera.so.
 
Thanks for the offer ;) Greatly appreciated. The stuff I have to figure out is not really related to the HAL module, as I already have software encoding working. It is w.r.t stagefright hardware encoding support. Anything you can offer in terms of tips from prior experience would go a long way. Sorry, I missed your question earlier. I thought I had posted the reason in the other thread and a smaller version in the first post. But here is the main difference between the other work and the work tracked in this thread. The other work was a complete compile from source code to integrate the source corresponding to libcamera.so and the hal new code requirement in ICS as one HAL module. This thread tracks work to make existing libcamera.so stuff from gingerbread work in binary form, with as little device specific stuff as feasible. That was the reason I had mentioned that this may or may not work with 3.0 kernels as it requires the gingerbread libcamera.so to be compatible with the 3.0 kernel due to the HAL module's hard dependency on libcamera.so.

I wasn't referring to your other thread, I was referring to the HD2 thread, which based on this explanation does the same thing.
Also, tips from previous experience will be useless without any form of code to relate them to. It sounds like going to a lot of trouble to keep the source concealed until such time as it can be released as a finished product rather than assist in the general progress of getting the camera to work in general.

Sent from my ADR6400L using Tapatalk
 
  • Like
Reactions: alpina0707

geenyous

Inactive Recognized Themer
Oct 20, 2007
1,785
853
Shanghai
twistedumbrella is right.
Don't you fear that we will not give you propper credit, since you developed your fix the use of ICS on HD2 has increased great time!
Everybody who is serious with flashing his HD2 with the latest goodies knows the name rapmv78 ;)
So unless you don't have any other reasons, I think it would be really beneficial to all of us if you guys could work on this final fix together.
I am sure donations will flow in your direction as soon as this is done... :D
 

ale8530

Senior Member
Sep 10, 2010
120
26
Rome
ICS with Qualcomm Processor

Rapmv78 Hello, I wanted to know if a rom ICS already developed with Qualcomm Adreno 220 processor and the processor can help you arrange Nexus One and Desire.

If you can help please contact me at ale@miui.it .
 

rapmv78

Senior Member
May 9, 2010
113
791
twistedumbrella is right.
Don't you fear that we will not give you propper credit, since you developed your fix the use of ICS on HD2 has increased great time!
Everybody who is serious with flashing his HD2 with the latest goodies knows the name rapmv78 ;)
So unless you don't have any other reasons, I think it would be really beneficial to all of us if you guys could work on this final fix together.
I am sure donations will flow in your direction as soon as this is done... :D

Well, I am not worried about credits or anything of that sort. Just did not want to release incomplete stuff and unclean code. Thats all. If someone can tell me a better way than a tarball to share the code, that would be great. Have been looking at using github for a while. For starters, I can use some newbie tips on how to use github, without much uploading and having to re-sync a brand new repo :) To be precise, I have started to use the everlov repo to be able to get the latest stuff, how do I create just the camera stuff into my github using the same repo url as evervolv?
 
  • Like
Reactions: geenyous
Well, I am not worried about credits or anything of that sort. Just did not want to release incomplete stuff and unclean code. Thats all. If someone can tell me a better way than a tarball to share the code, that would be great. Have been looking at using github for a while. For starters, I can use some newbie tips on how to use github, without much uploading and having to re-sync a brand new repo :) To be precise, I have started to use the everlov repo to be able to get the latest stuff, how do I create just the camera stuff into my github using the same repo url as evervolv?

Go to evervolv's github and pick the project containing the original files that match the ones you modified. Make sure you signed up for a github account first, and then click fork in the upper right of that project. This will create a page of your own that has their current files as a base.
6674504101_062ab5dc5e.jpg

To prevent cloning the wrong files and such, it is best to also set a default branch, by clicking Admin and on the new page selecting it from the list
6674504227_a882c1da6f.jpg

After you pick one from the list, clicking back to source will save the change
Next you will want to clone those files to a folder somewhere on your computer, but not the one you were already working in or you will lose what was there. For that, your best bet is to look at the new page that just popped up when you did the fork and grab that address listed under the main menu and do
Code:
git clone "the project url"
Once that makes the folder, you can take your files and overwrite the ones you just cloned with them, but make sure you dont just overwrite the entire main folder or it will delete the .git folder which you need. Finally, you can commit the changes with
Code:
git commit -a -m "I haz changes"
and then push it to your new fork with either
Code:
git push git@github.com:"username"/"project name".git HEAD:"branch" -f
if you have set up keys or if you have not gotten there yet just
Code:
git push
will prompt for the login and password and push the files to the current project (the folder you are in) and the current branch (whatever you set to default before cloning).
 
Last edited:

rapmv78

Senior Member
May 9, 2010
113
791
Got video to work finally with hardware encoder support as well. It is not as smooth as I would like it to, but I do not know what the issue is. I could see that all frames were encoded, so the issue is probably in the encoder or my SD card is slow. Would like some feedback on whether others see some stutters too or not. Updated the second post with new fastboot system images. Also source code is now available on my github, as promised :) DISCLAIMER: The code has a bunch of hacks and is not very clean, as I did not get much time to clean it up before sharing.

For people with non-nexus devices, you can use the source code to compile your own or here is just the HAL module as a separate download

http://www.mediafire.com/?87nizd1jrx01j49

You also need

media_profiles.xml which should to into /system/etc/

http://www.mediafire.com/?ig6t931i8h3zhzf

libmediaplayer.so which should go into /system/lib/

http://www.mediafire.com/?8jb64a94tdfe4vp

Here are the source changes for libmediaplayer.so
--- a/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp

uint32_t encoder_flags = 0;
- if (mIsMetaDataStoredInVideoBuffers) {
+ if (0 && mIsMetaDataStoredInVideoBuffers) {
encoder_flags |= OMXCodec::kHardwareCodecsOnly;
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
}

Enjoy!!
 
Last edited:

mulerokeh

Senior Member
Apr 22, 2010
144
19
Jakarta
downloading, feedback soon.. :)
thank you..

ehh, how to install?

fastboot flash system file.img

just like that?
sorry, noob question.. :D
Sent from my Nexus One
 
Last edited:

geenyous

Inactive Recognized Themer
Oct 20, 2007
1,785
853
Shanghai
ok, I installed by replacing the camera.qsd8k.so file in system/lib/hw, changed the permissions to rw-r-r and then rebooted.
The attached pic is what I get when going into camcorder plus when I press the record button nothing happens at all...
Zoom appears to work though.
Cam still works fine. You can find my specs in my sig and a log attached.
 

Attachments

  • Screenshot_2012-01-11-13-34-14.jpg
    Screenshot_2012-01-11-13-34-14.jpg
    21.6 KB · Views: 380
  • camcorderlog.7z
    19.2 KB · Views: 35
Last edited:

furius

Senior Member
Sep 6, 2009
380
56
yeah!
I would like to try this without installing all the img system from second post ... is there a way to flash only the camera related files on MeDroid v4.2?
 

Glen_H

Senior Member
Dec 14, 2009
73
30
Amsterdam
I have the same problem geenyous has with new camcorder.
adb pushed the file, changed permissions and rebooted.

I'm on a HD2 (eu)
radio 2.15.50.14
magldr 1.13
Build NexusHD2-ICS-CM9 c1.0
 

Attachments

  • logcat.txt
    32.8 KB · Views: 21

Bi0haZarD

Senior Member
Oct 19, 2007
981
357
Asus Transformer TF300T
LG G3
Got video to work finally with hardware encoder support as well. It is not as smooth as I would like it to, but I do not know what the issue is. I could see that all frames were encoded, so the issue is probably in the encoder or my SD card is slow. Would like some feedback on whether others see some stutters too or not. Updated the second post with new fastboot system images. Also source code is now available on my github, as promised :) DISCLAIMER: The code has a bunch of hacks and is not very clean, as I did not get much time to clean it up before sharing.

For people with non-nexus devices, you can use the source code to compile your own or here is just the HAL module as a separate download

http://www.mediafire.com/?87nizd1jrx01j49

Enjoy!!

did you try playback of recorded video on ICS? try also on pc or GB, ICS doesn't have HWA, only soft. Maybe that's the case of stuttering/chopped frame playback.

I have recorded a vid on CM7.2 GB /playback=perfect framerate. I playback the same file with same video player on ICS and i have stuttering/chopped frames.
 
Last edited:

jerpelea

Senior Recognized Developer
Nov 7, 2006
7,474
40,177
Lund
sites.google.com
01-05 10:52:34.267: E/HAL(1128): load: module=/system/lib/hw/camera.qsd8k.so
01-05 10:52:34.267: E/HAL(1128): Cannot load library: link_image[2048]: 1128 could not load needed library 'libcamera.so' for 'camera.qsd8k.so' (reloc_library[1384]: 1128 cannot locate '_ZN7android7Overlay7setCropEjjjj'...
01-05 10:52:34.267: E/HAL(1128): )
01-05 10:52:34.267: E/CameraService(1128): Could not load camera HAL module
 
Got video to work finally with hardware encoder support as well. It is not as smooth as I would like it to, but I do not know what the issue is. I could see that all frames were encoded, so the issue is probably in the encoder or my SD card is slow. Would like some feedback on whether others see some stutters too or not. Updated the second post with new fastboot system images. Also source code is now available on my github, as promised :) DISCLAIMER: The code has a bunch of hacks and is not very clean, as I did not get much time to clean it up before sharing.

For people with non-nexus devices, you can use the source code to compile your own or here is just the HAL module as a separate download

http://www.mediafire.com/?87nizd1jrx01j49

Enjoy!!

I imported your source to the ics branch of my existing qcom camera repository https://github.com/TwistedUmbrella/android_hardware_qcom_camera to start working on making it "generic"
I am assuming the Build-libcamera := nexus tells it to use the included libcamera-nexus.so, so the first step will be redirecting a device proprietary to that folder under the name legacy and aiming it to pick that up instead.
The only reference I don't have a clear understanding of is camera-inc

Sent from my ADR6400L using Tapatalk
 

rapmv78

Senior Member
May 9, 2010
113
791
I imported your source to the ics branch of my existing qcom camera repository https://github.com/TwistedUmbrella/android_hardware_qcom_camera to start working on making it "generic"
I am assuming the Build-libcamera := nexus tells it to use the included libcamera-nexus.so, so the first step will be redirecting a device proprietary to that folder under the name legacy and aiming it to pick that up instead.
The only reference I don't have a clear understanding of is camera-inc

Sent from my ADR6400L using Tapatalk

Actually the stuff is already pretty generic, except for the hardware accelerated copying. camera-inc was for droid incredible, but what I found is that the library for the exact device does not really matter. So, for other devices, all you need to make sure is that the hardware accelerated copy works and may be a few additional flags need to be set and that should be fine. All I have is a nexus one, so cannot really be very sure about it though.
 

rapmv78

Senior Member
May 9, 2010
113
791
ok, I installed by replacing the camera.qsd8k.so file in system/lib/hw, changed the permissions to rw-r-r and then rebooted.
The attached pic is what I get when going into camcorder plus when I press the record button nothing happens at all...
Zoom appears to work though.
Cam still works fine. You can find my specs in my sig and a log attached.

You need the right media_profiles.xml file and libmediaplayer.so (NOTE: this may not be compatible with your ROM and may boot loop. It is based off evervolv's code base), the links for which, I just added to the post. The media_profiles.xml file needs to go into /system/etc/ and the other file into /system/lib/. However, it may still not work as I do not know the state of the hardware encoder libs for your ROM.
 

bachmark

Senior Member
Mar 7, 2010
50
10
You need the right media_profiles.xml file and libmediaplayer.so (NOTE: this may not be compatible with your ROM and may boot loop. It is based off evervolv's code base), the links for which, I just added to the post. The media_profiles.xml file needs to go into /system/etc/ and the other file into /system/lib/. However, it may still not work as I do not know the state of the hardware encoder libs for your ROM.

I had the same problem as geenyous, now I installed the media_profile.xml from evervolv’s (github). Now I get a proper preview but recording stops immediately.

I don’t found any libmediaplayer.so, are you meaning libmediaplayerservices.so? Which libmediaplayerservice.so is suitable for the HD2 with tytung ICS 4.0.3?

Thanks
 

Attachments

  • logcat.txt
    4.9 KB · Views: 9

Top Liked Posts

  • There are no posts matching your filters.
  • 142
    I have re-written the ICS camera HAL module to be a thin wrapper for the gingerbread libcamera.so and hence it will only work with the 2.6 kernel. The advantage is that getting to gingerbread level functionality should be quick :) Creating a new thread because there is a slight chance that this will work for all qualcomm devices with existing libcamera.so files (with slight mods ofcourse :))

    http://www.mediafire.com/download.php?wjf035mz2vzunw4

    Here is a zip file which contains the new camera HAL module. README file accompanying it has instructions on the locations for the files. If you already have the previous version of camera HAL working, all you have to do is replace camera.qsd8k.so and libcamera.so with the ones in the zip file.

    What works:
    1) Preview works.
    2) Taking a picture works pretty well.
    3) Size of picture is no longer huge.
    4) Software zoom works.
    5) Most of the other knobs like focus, file size etc. seemed to work as well in my testing.
    6) Pretty stable as far as I can see :)

    Not working yet:
    Video and other fancy stuff.

    If people have requests for other qualcomm devices after having tried the HAL included in the zip file, kindly include the following information.
    1) logcat from having used the HAL module.
    2) build.prop
    3) libcamera.so from gingerbread ROM for the device.
    4) liboemcamera.so from gingerbread ROM.

    Currently known to work on the following devices:
    1) Nexus One.
    2) HTC Desire
    3) HTC HD2

    Enjoy and thanks for all the feedback.
    55
    Updates:

    02/09/2012

    Working barcode scanner mode

    Flashable zip file (should work with texasice's ROMs)
    http://www.mediafire.com/?w4fu0u05qtxq3tu

    01/30/2012
    Working Panorama mode

    Flashable zip file (should work with texasice's ROMs)
    http://www.mediafire.com/?5r599m5jg5yfaqn

    Known issues:
    Sometimes screen has some garbage while in Panorama mode viewfinder. Quitting completely from the app and restart or invoking Gallery from inside the app and returning back to camera app should mostly fix it.

    Video enabled version:

    Fastboot compatible images compiled from evervolv base:

    For Stock hboot :
    http://www.mediafire.com/?wdlip7h6necetia

    For HBoot(s) supporting larger /system partition
    http://www.mediafire.com/?f6rz3sz2r97qln0

    Source code is now available at
    https://github.com/rapmv78/
    14
    Got video to work finally with hardware encoder support as well. It is not as smooth as I would like it to, but I do not know what the issue is. I could see that all frames were encoded, so the issue is probably in the encoder or my SD card is slow. Would like some feedback on whether others see some stutters too or not. Updated the second post with new fastboot system images. Also source code is now available on my github, as promised :) DISCLAIMER: The code has a bunch of hacks and is not very clean, as I did not get much time to clean it up before sharing.

    For people with non-nexus devices, you can use the source code to compile your own or here is just the HAL module as a separate download

    http://www.mediafire.com/?87nizd1jrx01j49

    You also need

    media_profiles.xml which should to into /system/etc/

    http://www.mediafire.com/?ig6t931i8h3zhzf

    libmediaplayer.so which should go into /system/lib/

    http://www.mediafire.com/?8jb64a94tdfe4vp

    Here are the source changes for libmediaplayer.so
    --- a/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp
    +++ b/frameworks/base/media/libmediaplayerservice/StagefrightRecorder.cpp

    uint32_t encoder_flags = 0;
    - if (mIsMetaDataStoredInVideoBuffers) {
    + if (0 && mIsMetaDataStoredInVideoBuffers) {
    encoder_flags |= OMXCodec::kHardwareCodecsOnly;
    encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
    }

    Enjoy!!
    13
    Just updated the second post with a new flashable zip to enable panorama mode.
    The black lines should be either completely gone or very rare as far as I can tell.
    A bonus, Gallery hanging randomly should be fixed as well.
    Enjoy and thanks a lot for your feedback. Please keep them coming.
    12
    Have updated the post with another flashable zip file which should fix colors for the panorama mode and also the barcode scanner mode should work now.

    Enjoy!!