2.4.8: NativeActivity tutorial: black screen on THL W8 Beyond (MT6589) with Android 4.2 (Bug #3481)


Added by Igor K about 11 years ago. Updated almost 11 years ago.


Status:Done Start date:2014-01-11
Priority:Normal Due date:
Assignee:Alexander Smorkalov % Done:

0%

Category:android
Target version:2.4.9
Affected version:2.4.8 (latest release) Operating System:Android
Difficulty: HW Platform:ARM
Pull request:https://github.com/Itseez/opencv/pull/2501

Description

Hi.
Trying to get NativeCamera working and it doesn't work.
Logs are very noisy, so made a cut containing useful information and attached it.

Kick me if I'm wrong, but seems this way:
- libnative_camera SIGSEGVs
- MtkCam attempts to "deque" its buffers but has no client to accept.. no matter if its std::deque, or another buffer, the idea it's repeated >~150times per crash cycle does matter to me though.
- finally, "Disconnecting camera client 0x44d9cf50 since the binder for it died (this pid 5296)"

(wonder that if spam about "D/dalvikvm(12261): threadid=13: created from interp" is related too..)
Also, the phone is very good, even burst camera app and transparent stealth cam app worked on it previously and were removed prior to testing OpenCV, I doubt it's a general camera problem..

Here's a short resume of attached file..

D/OpenCV::camera(12335): Library name: libopencv_java.so
..
D/OpenCV::camera(12335): try to load library 'libnative_camera_r4.2.0.so'
..
W/ResMgrDrv( 5296): [CloseHdmi]WRN:HDMITX kernel open fail, errno(2):No such file or directory
..
D/lsc_mgr ( 5296): [getScenarioResolution] SensorOP 0 GrabX GrabY SrcW SrcH CropW CropH SubW SubH DataFmt (4, 4, 2000, 1500, 1996, 1496, 0, 0, 0)
..
D/MtkCam/ParamsManager( 5296): [updateParams] [12] picture-size=4096x3072;picture-size-values=256x144,320x240,512x288,640x480,1280x720,1024x768,1536x864,1280x960,1792x1008,1600x1200,2304x1296,2048x1536,2816x1584,2560x1920,3584x2016,3264x2448,4608x2592,4096x3072
D/MtkCam/ParamsManager( 5296): [updatePreviewFpsParams] preview-fps-range=30000,30000;preview-fps-range-values=(15000,15000),(24000,24000),(30000,30000)
D/MtkCam/ParamsManager( 5296): afeng-max-focus-step=0;afeng-min-focus-step=0;aflamp-mode=off;aflamp-mode-values=off,on,auto;antibanding=off;antibanding-values=off,50hz,60hz,auto;auto-exposure-lock-supported=true;auto-whitebalance-lock-supported=true;brightness=middle;brightness-values=low,middle,high;brightness_value=0;burst-num=1;cam-mode=0;cap-mode=normal;cap-mode-values=normal,face_beauty,continuousshot;capfname=/sdcard/DCIM/cap00;contrast=middle;contrast-values=low,middle,high;edge=middle;edge-values=low,middle,high;effect=none;effect-values=none,mono,negative,sepia,aqua,whiteboard,blackboard;exposure-compensation=0;exposure-compensation-step=1.0;fb-sharp=0;fb-sharp-max=4;fb-sharp-min=-4;fb-skin-color=0;fb-skin-color-max=4;fb-skin-color-min=-4;fb-smooth-level=0;fb-smooth-level-max=4;f
D/MtkCam/ParamsManager( 5296): b-smooth-level-min=-4;flash-mode=off;flash-mode-values=off,on,auto,red-eye,torch;focal-length=3.5;focus-distances=0.95,1.9,Infinity;focus-mode=auto;focus-mode-values=auto,macro,infinity,continuous-picture,continuous-video,manual,fullscan;horizontal-view-angle=55;hue=middle;hue-values=low,middle,high;iso-speed=auto;iso-speed-values=auto,100,200,400,800,1600;jpeg-quality=100;jpeg-thumbnail-height=128;jpeg-thumbnail-quality=100;jpeg-thumbnail-size-values=0x0,160x128,320x240;jpeg-thumbnail-width=160;max-exposure-compensation=3;max-num-detected-faces-hw=15;max-num-detected-faces-sw=0;max-num-focus-areas=1;max-num-metering-areas=9;max-zoom=10;min-exposure-compensation=-3;picture-format=jpeg;picture-format-values=jpeg;picture-size=4096x3072;picture-size-values=256x
D/MtkCam/ParamsManager( 5296): 144,320x240,512x288,640x480,1280x720,1024x768,1536x864,1280x960,1792x1008,1600x1200,2304x1296,2048x1536,2816x1584,2560x1920,3584x2016,3264x2448,4608x2592,4096x3072;preferred-preview-size-for-video=1920x1080;preview-format=yuv420sp;preview-format-values=yuv420sp,yuv420p,yuv420i-yyuvyy-3plane;preview-fps-range=5000,60000;preview-fps-range-values=(5000,60000);preview-frame-rate=30;preview-frame-rate-values=15,24,30;preview-size=640x480;preview-size-values=176x144,320x240,352x288,480x320,480x368,640x480,720x480,800x480,800x600,864x480,960x540,1280x720,1920x1080;rotation=0;saturation=middle;saturation-values=low,middle,high;scene-mode=auto;scene-mode-values=auto,portrait,landscape,night,night-portrait,theatre,beach,snow,sunset,steadyphoto,fireworks,sports,party,c
D/MtkCam/ParamsManager( 5296): andlelight,hdr;smooth-zoom-supported=true;vertical-view-angle=42;video-size=640x480;video-size-values=176x144,320x240,352x288,480x320,480x368,640x480,720x480,800x480,800x600,864x480,960x540,1280x720,1920x1080;video-snapshot-supported=true;video-stabilization=false;video-stabilization-supported=true;whitebalance=auto;whitebalance-values=auto,incandescent,fluorescent,warm-fluorescent,daylight,cloudy-daylight,twilight,shade;zoom=0;zoom-ratios=100,114,132,151,174,200,229,263,303,348,400;zoom-supported=true;zsd-mode=off;zsd-mode-values=off,on
D/MtkCam/ParamsManager( 5296): [updateDefaultParams] - ret(1)
D/MtkCam/ParamsManager( 5296): [updateHalAppMode] + KEY_CAMERA_MODE:0
...
I/GraphicBuffer( 133): allocate buffer (w:640 h:480 f:842094169) err(0)
I/BufferQueue(12169): [NEW] gb=0x5d1ebaa0, handle=0x5d223998, w=640, h=480, s=640, fmt=842094169
D/MtkCam/MtkCamUtils( 5296): [queryImgBufferSize] [yv12-gpu] 640x480 image buffer size: 460800
I/BufferQueue(12169): [unnamed-12169-0](this:0x5b97e170,api:4) new GraphicBuffer needed
D/BufferQueue(12169): [OLD] gb:NULL
E/IMGSRV ( 133): :0: gralloc_device_alloc: attach special flag :Format32315659.
...
D/MtkCam/PrvCB( 5296): (12210)[waitAndHandleReturnBuffers] +
I/DEBUG (12215): r0 00000002 r1 ffffffff r2 ffffff22 r3 5b97eae8
I/DEBUG (12215): r4 5d1e95f8 r5 00000078 r6 ffffffff r7 00000160
I/DEBUG (12215): r8 fffffff8 r9 5f454bc0 sl 00003852 fp 5ff4dec4
I/DEBUG (12215): ip ffffff80 sp 5ff4db08 lr 40090b88 pc 40091074 cpsr a0000010
I/DEBUG (12215):
I/DEBUG (12215): backtrace:
I/DEBUG (12215): #00 pc 00016074 /system/lib/libc.so (dlmalloc+1844)
I/DEBUG (12215): #1 pc 0001af3c /system/lib/libc.so (dlrealloc+168)
I/DEBUG (12215): #2 pc 0000cb80 /system/lib/libc.so (realloc+16)
I/DEBUG (12215): #3 pc 0000f201 /system/lib/libutils.so (android::SharedBuffer::editResize(unsigned int) const+24)
I/DEBUG (12215): #4 pc 0000f905 /system/lib/libutils.so (android::String8::real_append(char const*, unsigned int)+24)
I/DEBUG (12215): #5 pc 00014aa7 /system/lib/libcamera_client.so (android::CameraParameters::flatten() const+94)
I/DEBUG (12215): #6 pc 000158b1 /data/app-lib/org.opencv.lib_v24_armv7a-1/libnative_camera_r4.2.0.so (CameraHandler::applyProperties(CameraHandler**)+68)
I/DEBUG (12215):
I/DEBUG (12215): stack:
I/DEBUG (12215): 5ff4dac8 5f454dc8
I/DEBUG (12215): 5ff4dacc 00000000
I/DEBUG (12215): 5ff4dad0 00000000
I/DEBUG (12215): 5ff4dad4 5d1c7080
I/DEBUG (12215): 5ff4dad8 00002869
I/DEBUG (12215): 5ff4dadc 0000289a
I/DEBUG (12215): 5ff4dae0 00000001
I/DEBUG (12215): 5ff4dae4 4013b1d1 /system/lib/libutils.so (android::VectorImpl::insertAt(void const*, unsigned int, unsigned int)+44)
I/DEBUG (12215): 5ff4dae8 5ff4db20 [stack:12196]
I/DEBUG (12215): 5ff4daec 00000040
I/DEBUG (12215): 5ff4daf0 0785aa28
I/DEBUG (12215): 5ff4daf4 00054290
I/DEBUG (12215): 5ff4daf8 0000006d
I/DEBUG (12215): 5ff4dafc 00000000
I/DEBUG (12215): 5ff4db00 df0027ad
I/DEBUG (12215): 5ff4db04 00000000
I/DEBUG (12215): #00 5ff4db08 5d1d4368
I/DEBUG (12215): 5ff4db0c 40090b20 /system/lib/libc.so (dlmalloc+480)
I/DEBUG (12215): 5ff4db10 40514bac /system/lib/libcamera_client.so (android::CameraParameters::KEY_PREVIEW_SIZE)
I/DEBUG (12215): 5ff4db14 40510cb1 /system/lib/libcamera_client.so (android::CameraParameters::set(char const*, char const*)+104)
I/DEBUG (12215): 5ff4db18 00000001
I/DEBUG (12215): 5ff4db1c 0000004a
I/DEBUG (12215): 5ff4db20 5d1d4368
I/DEBUG (12215): 5ff4db24 41d09fd0
I/DEBUG (12215): 5ff4db28 5d1d4360
I/DEBUG (12215): 5ff4db2c 40093c2c /system/lib/libc.so (dlfree+608)
I/DEBUG (12215): 5ff4db30 5ea6b260 /data/app-lib/org.opencv.lib_v24_armv7a-1/libnative_camera_r4.2.0.so
I/DEBUG (12215): 5ff4db34 40510d9b /system/lib/libcamera_client.so (android::CameraParameters::setPreviewSize(int, int)+46)
I/DEBUG (12215): 5ff4db38 00000280
I/DEBUG (12215): 5ff4db3c 000001e0
I/DEBUG (12215): 5ff4db40 0000006d
I/DEBUG (12215): 5ff4db44 78303436
I/DEBUG (12215): ........ ........
I/DEBUG (12215): #1 5ff4dbb0 41d09fd0
I/DEBUG (12215): 5ff4dbb4 5ff4dc28 [stack:12196]
I/DEBUG (12215): 5ff4dbb8 0000005d
I/DEBUG (12215): 5ff4dbbc 40087b84 /system/lib/libc.so (realloc+20)
I/DEBUG (12215): #2 5ff4dbc0 00000001
I/DEBUG (12215): 5ff4dbc4 40138205 /system/lib/libutils.so (android::SharedBuffer::editResize(unsigned int) const+28)
I/DEBUG (12215):
I/DEBUG (12215): memory near r3:
I/DEBUG (12215): 5b97eac8 00000000 00000000 3b303800 00000001 .........80;....
I/DEBUG (12215): 5b97ead8 00000000 00000000 00000000 37313d73 ............s=17
I/DEBUG (12215): 5b97eae8 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 5b97eaf8 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 5b97eb08 00000000 34362c38 ffffffff ffffffff ....8,64........
I/DEBUG (12215):
I/DEBUG (12215): memory near r4:
I/DEBUG (12215): 5d1e95d8 00000000 00000008 00000000 00000000 ................
I/DEBUG (12215): 5d1e95e8 00000000 5d1e95b4 5d1e95ac 00000000 .......]...]....
I/DEBUG (12215): 5d1e95f8 00000000 000001d9 5d1e95f8 5d1e95f8 ...........]...]
I/DEBUG (12215): 5d1e9608 5b97eae8 00000000 400e4d2c 00000001 ...[....,M.....
I/DEBUG (12215): 5d1e9618 6f662d78 2d737563 70657473 613b303d x-focus-step=0;a
I/DEBUG (12215):
I/DEBUG (12215): memory near r9:
I/DEBUG (12215): 5f454ba0 00000000 00000000 5d1c7430 5d1c7460 ........0t.]`t.]
I/DEBUG (12215): 5f454bb0 5d1c7808 5d1c7478 5d1c6ef8 5d1c7838 .x.]xt.].n.]8x.]
I/DEBUG (12215): 5f454bc0 5d1c6f18 5d1c6f40 5d1c76c8 5d1c6f60 .o.]@o.].v.]`o.]
I/DEBUG (12215): 5f454bd0 5d1c77d0 5d1c7d10 5d1c7d38 5d1c7d70 .w.].}.]8}.]p}.]
I/DEBUG (12215): 5f454be0 5d1c6e10 5d1c6e48 5d1c6e68 5d1c7f60 .n.]Hn.]hn.]`..]
I/DEBUG (12215):
I/DEBUG (12215): memory near sl:
I/DEBUG (12215): 00003830 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 00003840 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 00003850 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 00003860 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215): 00003870 ffffffff ffffffff ffffffff ffffffff ................
I/DEBUG (12215):
I/DEBUG (12215): memory near fp:
I/DEBUG (12215): 5ff4dea4 00000000 5d1c8c68 8cd8e39b 5d1e8840 ....h..]....
..]
I/DEBUG (12215): 5ff4deb4 00000000 00000000 5ff4df00 5ff4dee4 ..........._..._
I/DEBUG (12215): 5ff4dec4 5e4f2da0 00000000 5d1e8854 5d1e8800 .-O^....T..]...]
I/DEBUG (12215): 5ff4ded4 5d1e8800 5d1e8800 5d1c7038 00000016 ...]...]8p.]....
I/DEBUG (12215): 5ff4dee4 4008905c 5d1e8800 5ff4df00 bee034d8 \.....]..._.4..
I/DEBUG (12215):
I/DEBUG (12215): memory near sp:
I/DEBUG (12215): 5ff4dae8 5ff4db20 00000040 0785aa28 00054290 .._
...(....B..
I/DEBUG (12215): 5ff4daf8 0000006d 00000000 df0027ad 00000000 m........'......
I/DEBUG (12215): 5ff4db08 5d1d4368 40090b20 40514bac 40510cb1 hC.] ...KQ..Q@
I/DEBUG (12215): 5ff4db18 00000001 0000004a 5d1d4368 41d09fd0 ....J...hC.]...A
I/DEBUG (12215): 5ff4db28 5d1d4360 40093c2c 5ea6b260 40510d9b `C.],<.`..^..Q
I/DEBUG (12215):
I/DEBUG (12215): code around pc:
I/DEBUG (12215): 40091054 03e08000 e288404c e7963104 e5936004 [email protected]...`..
I/DEBUG (12215): 40091064 e1a04003 e3c67007 e0657007 ea000006 ....p...pe.....
I/DEBUG (12215): 40091074 e5961004 e1a03006 e3c18007 e065c008 .....0........e.
I/DEBUG (12215): 40091084 e15c0007 31a0700c 31a04006 e5936010 ..\..p.1.
.1.`..
I/DEBUG (12215): 40091094 e3560000 1afffff5 e5936014 e3560000 ..V......`....V.
I/DEBUG (12215):
I/DEBUG (12215): code around lr:
I/DEBUG (12215): 40090b68 e5821008 e58c3004 e78c1001 e5845004 .....0.......P..
I/DEBUG (12215): 40090b78 e2844008 eaffffe0 e2800d07 ebffde0a ...............
I/DEBUG (12215): 40090b88 e3500000 0affff77 e3a04000 eaffffe1 ..P.w....
......
I/DEBUG (12215): 40090b98 ebfff13f eaffff6e e59f2d38 e285500b ?...n...8-...P..
I/DEBUG (12215): 40090ba8 e3c55007 e08f3002 e593c004 e35c0000 .P...0........\.
D/awb_algo( 5296): [PV AWB Gain] Rgain = 769, Ggain = 512, Bgain = 842
..
I/MtkCam/MtkCamUtils( 5296): {CamProfile}[::updateOne] : (0-th) ===> [start-->now: 90 ms]
D/MtkCam/PrvCB( 5296): (12210)[handleReturnBuffers] + 34ms<Duration(90) 34ms<Duration(90)
D/MtkCam/PrvCQT( 5296): (12213)[update] frameCnt(68)
D/MtkCam/PrvCB( 5296): (12210)[handleReturnBuffers] callback:0(1) [0x44f11000/460800 0x19c78410] CookieDE:0x3af
D/MtkCam/VSSScen( 5296): [deque] +
..
D/dalvikvm(12261): threadid=13: interp stack at 0x5df68000
D/dalvikvm(12261): threadid=13: created from interp
..
D/MtkCam/VSSScen( 5296): [deque] +
..
W/InputDispatcher( 5535): channel '42e0ebf0 org.opencv.samples.NativeActivity/org.opencv.samples.NativeActivity.CvNativeActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 5535): channel '42e0ebf0 org.opencv.samples.NativeActivity/org.opencv.samples.NativeActivity.CvNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
D/ADB_SERVICES( 9881): adb fdevent_process list (53) (55) (30) (48) (42) (54) (38)
W/ADB_SERVICES( 9881): terminating JDWP 12169 connection: Try again
D/ADB_SERVICES( 9881): remove pid 12169 to jdwp process list
D/ADB_SERVICES( 9881): adb socket read list (48) (54) (39)
D/ADB_SERVICES( 9881): read_data=69
D/ADB_SERVICES( 9881): max_read_time=0.000050 max_send_time=0.000007
D/ADB_SERVICES( 9881): closing because is_eof=1 r=0 s->fde.force_eof=0
D/AEE/AED (12215): put_in_archive: Archive file /sdcard/mtklog/aee_exp/temp/db.E12215/__exp_main.txt, size 1149
E/SurfaceTextureClient( 5296): queueBuffer: error queuing buffer to SurfaceTexture, -32
D/IPCThreadState( 5296): [DN #5] BR_DEAD_BINDER cookie 0x42a35e30
W/CameraService( 5296): Disconnecting camera client 0x44d9cf50 since the binder for it died (this pid 5296)


mtk6589.log - log taken from THL W8 Beyond in the middle of running application (1.3 MB) Igor K, 2014-01-11 01:02 pm

163930.log - log taken from THL W8 Beyond - launch of modified app with AOSP libcamera, and sigsev (3.3 MB) Igor K, 2014-01-11 01:45 pm

Screenshot_2014-01-11-18-45-45.png - this appears after few hours of work (79.8 kB) Igor K, 2014-01-11 05:52 pm


Associated revisions

Revision bada364e
Added by Vadim Pisarevsky over 10 years ago

Merge pull request #3481 from mshabunin:python-test

History

Updated by Igor K about 11 years ago

Found that:

D/OpenCV_NativeCamera(12169): CameraHandler::applyProperties()
F/libc (12169): Fatal signal 11 (SIGSEGV) at 0x00000003 (code=1), thread 12196 (.NativeActivity)

Replacing libcamera_client.so to AOSP (don't ask why so) and commenting out call to:

if ((camera_resolution.width != 0) && (camera_resolution.height != 0))
{
engine->capture->set(CV_CAP_PROP_FRAME_WIDTH, camera_resolution.width);
engine->capture->set(CV_CAP_PROP_FRAME_HEIGHT, camera_resolution.height);
}

leads to:

34394-I/DEBUG (26188): #9 pc 00017097 /data/app-lib/org.opencv.lib_v24_armv7a-1/libnative_camera_r4.2.0.so (CameraHandler::initCameraConnect(bool (* const&)(void*, unsigned int, void*), int, void*, android::CameraParameters*)+1686)

This clearly makes me feel that 2.4.8 has some memory corruption inside.

Updated by Alexander Smorkalov about 11 years ago

  • Category set to android
  • Target version set to 2.4.9
  • Assignee set to Alexander Smorkalov

Updated by Andrew Senin about 11 years ago

  • Status changed from New to Open

Updated by Alexander Smorkalov almost 11 years ago

  • Status changed from Open to Done
  • Pull request set to https://github.com/Itseez/opencv/pull/2501

Also available in: Atom PDF