Issues with Neon optimisations for libpng

Asked by Sonam on 2013-03-05

After taking your changes for integration of Android with libpng 1.5.7 and Neon optimisations, I am facing two issues:

1) onDecodeRegion() crashes for Grayscale images.
Fatal signal 11 (SIGSEGV) at 0x725f3000 (code=2),

2) If NEON macro is enabled, my Android phone crashes on boot up.
backtrace:
I/DEBUG ( 2383): #00 pc 0010ecf8 /system/lib/libskia.so (png_read_filter_row_sub4_neon+8)
I/DEBUG ( 2383): #01 pc 001098c9 /system/lib/libskia.so (png_read_filter_row+156)
I/DEBUG ( 2383): #02 pc 00102d5d /system/lib/libskia.so (png_read_row+536)
I/DEBUG ( 2383): #03 pc 00102ea7 /system/lib/libskia.so (png_read_rows+78)
I/DEBUG ( 2383): #04 pc 000b70f4 /system/lib/libskia.so (SkPNGImageDecoder::onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode)+1352)
I/DEBUG ( 2383): #05 pc 000b2818 /system/lib/libskia.so (SkImageDecoder::decode(SkStream*, SkBitmap*, SkBitmap::Config, SkImageDecoder::Mode, bool)+

Am I missing anything ? I took the changed files and put them in the external/libpng folder and did "mm -B". Also put the SkImageDecoder_libpng.cpp in Skia and rebuilt it. I did not run any configure scripts or any other scripts in the libpng.

Please let me know what am I doing wrong.
Thanks & Regards
Soskumar

Question information

Language:
English Edit question
Status:
Open
For:
Linaro Multimedia WG project Edit question
Assignee:
Mans Rullgard Edit question
Last query:
2013-03-13
Last reply:
2013-03-13
Tom Gall (tom-gall) said : #1

Hi Soskumar,

Sounds like perhaps filing a bug will be in order. Which version of Android are you building with out of curiosity?

Mans Rullgard (mansr) said : #2

Can you share an image that causes it to crash?

Sonam (soskumar) said : #3

Hi,
Of the two reported issues, I am still facing issue with the first one i.e. onDecodeRegion().
I am able to fix the second one - neon crash. It was happening because I enabled the PNG_ARM_NEON flag in the Android.mk but did not enable PNG_ALIGNED_MEMORY_SUPPORTED. If I enable both the flags, this crash disappears.

So regarding the onRegionDecoder(), use any Grayscale images, I downloaded lots of Grayscale images from the web and it crashes for each one of them. I am using Android 4.1 API level 16.

I used add2line and this is the crash dump:

********** Crash dump: **********
Build fingerprint: 'samsung/ja3gxx/ja3g:4.2.1/JOP40D/JA3G_TEST:eng/test-keys'
pid: 6357, tid: 6357, name: a.unittest2.app >>> com.samsung.sophia.unittest2.app <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr fffffffe
Stack frame #00 pc fffffffe <unknown>
Stack frame #01 pc 0000c5a0 /system/lib/libz.so (inflateCopy+72): Routine inflateCopy in external/zlib/src/inflate.c:1438
Stack frame #02 pc 0010198d /system/lib/libskia.so (png_configure_decoder+106): Routine png_configure_decoder in external/libpng/pngread.c:964
Stack frame #03 pc 000b7108 /system/lib/libskia.so (SkPNGImageDecoder::onDecodeRegion(SkBitmap*, SkIRect)+2128): Routine onDecodeRegion in external/skia/src/images/SkImageDecoder_libpng.cpp:799
Stack frame #04 pc 000b1e34 /system/lib/libskia.so (SkImageDecoder::decodeRegion(SkBitmap*, SkIRect, SkBitmap::Config)+76): Routine decodeRegion in external/skia/src/images/SkImageDecoder.cpp:179
Stack frame #05 pc 000b14dc /system/lib/libskia.so (SkBitmapRegionDecoder::decodeRegion(SkBitmap*, SkIRect, SkBitmap::Config, int)+84): Routine decodeRegion in external/skia/src/images/SkBitmapRegionDecoder.cpp:6
Stack frame #06 pc 0007724b /system/lib/libandroid_runtime.so: Routine nativeDecodeRegion in frameworks/base/core/jni/android/graphics/BitmapRegionDecoder.cpp:236
Stack frame #07 pc 0001e3d0 /system/lib/libdvm.so (dvmPlatformInvoke+112): Routine <unknown> in dalvik/vm/arch/arm/CallEABI.S:258
Stack frame #08 pc 0004d5d1 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+396): Routine dvmCallJNIMethod in dalvik/vm/Jni.cpp:1169
Stack frame #09 pc 00038d4d /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8): Routine dvmCheckCallJNIMethod in dalvik/vm/CheckJni.cpp:136
Stack frame #10 pc 000277e0 /system/lib/libdvm.so: Routine <unknown> in dalvik/vm/mterp/out/InterpAsm-armv7-a-neon.S:16240
Stack frame #11 pc 0002b6c4 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184): Routine dvmInterpret in dalvik/vm/interp/Interp.cpp:1956
Stack frame #12 pc 000600c7 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374): Routine dvmInvokeMethod in dalvik/vm/interp/Stack.cpp:737
Stack frame #13 pc 00067ab1 /system/lib/libdvm.so: Routine Dalvik_java_lang_reflect_Method_invokeNative in dalvik/vm/native/java_lang_reflect_Method.cpp:101
Stack frame #14 pc 000277e0 /system/lib/libdvm.so: Routine <unknown> in dalvik/vm/mterp/out/InterpAsm-armv7-a-neon.S:16240
Stack frame #15 pc 0002b6c4 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184): Routine dvmInterpret in dalvik/vm/interp/Interp.cpp:1956
Stack frame #16 pc 000600c7 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374): Routine dvmInvokeMethod in dalvik/vm/interp/Stack.cpp:737
Stack frame #17 pc 00067ab1 /system/lib/libdvm.so: Routine Dalvik_java_lang_reflect_Method_invokeNative in dalvik/vm/native/java_lang_reflect_Method.cpp:101
Stack frame #18 pc 000277e0 /system/lib/libdvm.so: Routine <unknown> in dalvik/vm/mterp/out/InterpAsm-armv7-a-neon.S:16240
Stack frame #19 pc 0002b6c4 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184): Routine dvmInterpret in dalvik/vm/interp/Interp.cpp:1956
Stack frame #20 pc 0005fdf1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272): Routine dvmCallMethodV in dalvik/vm/interp/Stack.cpp:526
Stack frame #21 pc 00049b43 /system/lib/libdvm.so: Routine CallStaticVoidMethodV in (null):0
Stack frame #22 pc 0003d0a3 /system/lib/libdvm.so: Routine Check_CallStaticVoidMethodV in (null):0
Stack frame #23 pc 0004bcc3 /system/lib/libandroid_runtime.so: Routine CallStaticVoidMethod in libnativehelper/include/nativehelper/jni.h:793
Stack frame #24 pc 0004d047 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390): Routine start in frameworks/base/core/jni/AndroidRuntime.cpp:1370
Stack frame #25 pc 00000db7 /system/bin/app_process

Can you help with this problem?

Provide an answer of your own, or ask Sonam for more information if necessary.

To post a message you must log in.