xen0n / android_device_meizu_arale

Device tree for Meizu MX4 (common part + Ubuntu Edition)
34 stars 28 forks source link

CM13.0 porting progress #17

Closed xen0n closed 1 year ago

xen0n commented 8 years ago

Main porting

and...

xen0n commented 8 years ago

Camera is very hard to fix on MX4, due to Meizu customizing the components so extensively that the stock MTK code drop would be highly unlikely to work. After a bit of mtkcam source fixing, preview works but on actually taking photo libcam.camnode.so seems to indirectly cause a pure virtual function call and bring down mediaserver.

Going on to RIL instead...

xen0n commented 8 years ago

SIM card is recognized but not fully initialized; the IMS and VoLTE blobs seem to be correctly wired up from the current very limited observations.

xen0n commented 8 years ago

Another quick note to anyone who might be stalking :smiley: :

Radio initialization now progresses until initial attach! MTK Fast Dormancy and world phone impls both seem happy... Will move on to com.android.internal.telephony.dataconnection.

Almost 2 am here but not going to sleep before finishing the package, sad :sleepy:

xen0n commented 8 years ago

Quick note: voice, SMS and cellular connectivity all worked, cleaning the code up right now and will push once I finish.

MMS is of lower priority; VoLTE needs more investigation. Currently the IMS registration requests seem to be stuck, but I'm not absolutely sure that the request blocking RIL_CMD_PROXY_3 is indeed from the IMS stack. :crying_cat_face:

xen0n commented 8 years ago

A note about SELinux:

[    1.536497]<5> (5)[1:init]init: init started!
[    1.537898]<5> (5)[1:init]SELinux:  policydb version 30 does not match my version range 15-29
[    1.538092]<5> (5)[1:init]init: SELinux:  Could not load policy:  Invalid argument
[    1.538268]<5> (5)[1:init]init: failed to load policy: Invalid argument
[    1.538310]<5> (5)[1:init]init: Security failure; rebooting into recovery mode...

Apparently the Lollipop kernel couldn't load policy database built for M... let's workaround it then...

ferhung-mtk commented 8 years ago

It seems that you make the source more complicated. It's a good job, but not a good idea.

xen0n commented 8 years ago

@ferhung-mtk Which repo do you mean? If you mean the telephony stack the modification is indeed intrusive due to my trial-and-error approach to porting, but as the branch name implies, that is not the cleaned version. I still have to carefully pick out the essential bits out and that takes time; properly separating the commits is difficult because at the beginning you generally don't know exactly what to include, but actually including something usually means a heck of a lot of compilation errors which obviously can't be tolerated in a properly authored commit. So I have to open a separate branch for experiments, and only merge the proven bits back into the supposed main branch.

On another note, probably the sources inside the mtk folder could use more attention; separating into own Git repos could be more elegant but I hadn't bothered to do that.

xen0n commented 8 years ago

Just done cleaning the telephony stack, all modifications are pushed. Doing full rebuild to verify makefiles.

NOTE: Telephony stack currently reports raw mccmnc as operator alpha, will fix shortly.

xen0n commented 8 years ago

Full rebuild was done, fixed some makefiles in device tree. DRM is broken currently, will fix later.

ferhung-mtk commented 8 years ago

About "policydb version 30 does not match my version range 15-29":

In "external/sepolicy/Android.mk", look at "POLICYVERS ?= 30" Then force policy version to 26 as android 5.0 or other version.

And look at "external/selinux/checkpolicy/checkpolicy.c", change "n = strtol(optarg, NULL, 10);" to "n = 26;".

IT IS UNTESTED. YOU CAN TRY IT.

xen0n commented 8 years ago

@ferhung-mtk I've already fixed that by reverting the ioctl-related commits in sepolicy repo (which require version 30), and setting POLICYVERS := 29 in device_common.mk (as ?= is default value and can be overridden).

xen0n commented 8 years ago

Okay... it seems the IMS registration for VoLTE never really finished, and the request blocking RIL_CMD_PROXY_3 should be from the mal daemon (don't really know what that abbreviation means). However as the baseband is not easily replaced I may have to dig a little bit more before giving up :disappointed:

bobledeveloper commented 8 years ago

If you need a tester i can ^^ I'm a little Resourceful so if you need help maybe i can ;D

wojted commented 8 years ago

no new news about porting CM 13?

xen0n commented 8 years ago

@wojted I'm busy with my academic work so this is paused until June, as for CM13 only camera remained (VoLTE seems nearly impossible after investigation, MTK rewrote their IMS/VoLTE logic but the corresponding baseband blob is not available. As MT6595 seemed to have support for VoLTE by looking at strings inside the baseband, this surely looks like planned obsolescence.)

wojted commented 8 years ago

Thank you for the quick reply. I wish you luck in your academic work. We will all wait patiently for CM 13.

xen0n commented 8 years ago

Thanks for @fire855's extremely insightful approach to camera blob compatibility, at least still photos can be taken now! Bluetooth startup hangs are also fixed.

Some more time for shaking the remaining bugs out and we'll have CM13!

xen0n commented 8 years ago

SELinux should be nearly full-working now. Focusing on more AV blob compatibility bugs...

bobledeveloper commented 8 years ago

Good news !! Thanks for your work ;D

mayphus commented 8 years ago

Great! Thank you. I want to know how long can we reach the CM 13 for Meizu MX4

xen0n commented 8 years ago

@tangmifa After I fix all the known bugs, maybe I can finish them this month but who knows ;-)

zh0uyawen commented 8 years ago

thks

xen0n commented 8 years ago

Oh actually video recording should be all fine now; but it seems OpenMAX is severely broken, so screencasts and video playback are failing. Oh my.

zh0uyawen commented 8 years ago

cm13 will be coming soon,that's great !thank you for your hard work!

mayphus commented 8 years ago

吓我一跳,还以为正放包呢

xen0n commented 8 years ago

For other fellow MTK Marshmallow porters:

You'll want the commits below to fix your camera and OpenMAX. Of course if you're using my trees directly then no problem!

Hikari-no-Tenshi commented 8 years ago

@xen0n, thanks for av commits. Now i can use stock libMtkOmxVenc (Videorecord & Screencast are working). But my blobs needs extra mtk changes for color convertion (camera produces video in blue color).

xen0n commented 8 years ago

Incoming calls are now working... Very silly mistake of mine. Go checkout the telephony repo for details. I'm thinking about just declaring HDR photo and screencast as known bugs and just cut a release...

ferhung-mtk commented 8 years ago

@xen0n good job for av commits. I used these commits from mtk four month ago. But some core i make more mistakes, i will use your commit to have a test.

xen0n commented 8 years ago

HDR photo taking is fixed! Quite a bit of porting here. You need the frameworks/av and frameworks/base commits. I haven't squashed them, should more CAF code enters CM and disrupts future merging, so you're going to cherry-pick for yourself.

Hikari-no-Tenshi commented 8 years ago

@xen0n , when You will have time, please, take a look on my commit for color converter https://github.com/ResurrectionRemix-mtk/android_frameworks_av-rr/commit/d38547c624bc5d8d773edd34e52a0d63e870d0de On lollipop similar code was working good, but on marshmallow it makes phone stuck on bootanimation.

ferhung-mtk commented 8 years ago

@Hikari-no-Tenshi I think you should use the MM core of this similar commit. Or use the prebuild blobs which are from MM.

Hikari-no-Tenshi commented 8 years ago

@ferhung-mtk, bootloop is solved (i was need to use libcamera_client and libcameraservice compiled from source instead of prebuild). But there is another problem. Recorder uses OMX.google.h264.encoder, that doesn't support OMX_MTK_COLOR_FormatYV12.

Logcat: E ACodec : [OMX.google.h264.encoder] does not support color format 2130706944 E ACodec : [OMX.google.h264.encoder] configureCodec returning error -2147483648 E ACodec : signalError(omxError 0x80000000, internalError -2147483648) E MediaCodec: Codec reported err 0x80000000, actionCode 0, while in state 3 E MediaCodec: configure failed with err 0x80000000, resetting... E StagefrightRecorder: Failed to create video encoder E MediaRecorder: start failed: -2147483648 E CAM_VideoModule: Could not start media recorder.

Where can i get MM sources? I have only for KK & L.

xen0n commented 8 years ago

@Hikari-no-Tenshi I have some M sources, I'll upload the frameworks/av part later in the day.

Hikari-no-Tenshi commented 8 years ago

@xen0n Thanks. Can You also upload frameworks/native and system/core? Now i have working 8Mpx camera, screencast, youtube, twitch, but this blue video is killing me. On L it was more simple with color convertion.

bobledeveloper commented 8 years ago

In remaining bugs, all checked are fixed?

xen0n commented 8 years ago

@Hikari-no-Tenshi Oh, sure. I'm uploading first CM13.0 release right now, will do that in the evening (have to go out after announcing the release)

@bobledeveloper Yep they are!

bobledeveloper commented 8 years ago

Woah you fast like lucky luck xD

Hikari-no-Tenshi commented 8 years ago

Looks like all my work for porting mtk color convertion was waste of time. Recorder doesn't want to use my old KK MtkOmxVenc (it uses Google h264 encoder instead). Replacing libMtkOmxCore.so, libMtkOmxVdec.so and libMtkOmxVenc.so blobs with ones from @ferhung-mtk repo, fixes recorder blue video, but breaks Screencast and Twitch. Is there a way to fix Screencast and Twitch wile using new libMtkOmx* blobs?

bobledeveloper commented 8 years ago

I can't read any video from youtube app, my sister got a MX4 with cm12.1 it works but me with cm13 not. It's possible the bug is from the rom?

bobledeveloper commented 8 years ago

[url=http://www.noelshack.com/2016-25-1466865211-screenshot-20160625-163132.png][img]http://image.noelshack.com/minis/2016/25/1466865211-screenshot-20160625-163132.png[/img][/url]

xen0n commented 8 years ago

@Hikari-no-Tenshi Hey I finally found time to upload the sources! The code drop is a bit old (from February 2016), but that's the very first Marshmallow code drop from MTK and I haven't downloaded the latest drop yet. They are here!

xen0n commented 8 years ago

@bobledeveloper I don't know, I would have to investigate further. The (mostly Chinese) video apps I tested all work, but I haven't tried YouTube.

Hikari-no-Tenshi commented 8 years ago

@xen0n Thanks! Could You tell me where to download full MM code drop (if it's not a top secret info)?

xen0n commented 8 years ago

@Hikari-no-Tenshi I download them from Vanzo's server, seems the credentials are disclosed in a few places like here (look for vanzo_guest_0). You could also directly ssh into the machine and see what sources are available (note some of the repos are empty). This is invaluable resource from Vanzo, please be kind using it! 😄

Hikari-no-Tenshi commented 8 years ago

@xen0n Can't connect. What is the name of repo that You cloned?

xen0n commented 8 years ago

@Hikari-no-Tenshi It's mt6753_n351bh_tf03_toro_cc_256gbitp16d3_m_lte_3m-fdd-cs_mul_20160225, you could search for that. Maybe the machine's connectivity is bad outside of China.

Hikari-no-Tenshi commented 8 years ago

Looks like they have changed password. Gives error: "Permission denied, please try again.".

xen0n commented 8 years ago

@Hikari-no-Tenshi No they haven't, it's still adt$$n3. I just logged in to check for new sources.

Hikari-no-Tenshi commented 8 years ago

@xen0n Strange... Sorry for bothering You. Can You tell me how to connect properly (my email: kyryljan.serhij@gmail.com)?.