简体   繁体   English

Android RenderScript信号7(SIGBUS),代码1(BUS_ADRALN),故障加法器0x76f458b4 Adreno 306、320

[英]Android RenderScript signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x76f458b4 Adreno 306, 320

I'm having problem on two test devices- Samsung Galaxy J5 ,Android 6.0.1, Kernel 3.10.49-11903637, Build MMB29M.J510FNXXU2AQG3 GPU Adreno 306, and Nexus 4 -GPU Adreno 320. I am trying to calculate the sharpness of the bitmap, by making two filtrations on bitmap. 我在两个测试设备上遇到问题-三星Galaxy J5,Android 6.0.1,内核3.10.49-11903637,Build MMB29M.J510FNXXU2AQG3 GPU Adreno 306和Nexus 4 -GPU Adreno 320。通过对位图进行两次过滤来生成位图。 Sampled size of original bitmap is used, with size less than 64x64, for performance. 使用原始位图的采样大小(小于64x64)以提高性能。 Same code works just fine on Samsung Galaxy S6, Sony Xperia Z3, Samsung Galaxy Tab 10.1 (2016), Huawei P10. 相同的代码在Samsung Galaxy S6,Sony Xperia Z3,Samsung Galaxy Tab 10.1(2016)和Huawei P10上都可以正常工作。 Tried changing input parameters, used different images, different coefficients, but on J5 it always crashes. 尝试更改输入参数,使用不同的图像,不同的系数,但是在J5上,它总是崩溃。

Update: For photos taken on other devices, pass successfully when are rotated to portrait,( height bigger than width). 更新:对于在其他设备上拍摄的照片,将其旋转为人像(高度大于宽度)后,可以成功通过。 However photos taken on same device, crash no mater how i rotate them. 但是在同一设备上拍摄的照片,无论如何旋转都不会崩溃。

val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeFile(imagePath, options)

val imageSize = SizeT(options.outWidth, options.outHeight)
val imageScale = imageSize.scaleToFitInSize( SizeT( 64, 64) )
val imageScaledSize = imageSize.scale(imageScale.toDouble())
options.inJustDecodeBounds = false
options.inSampleSize = ImageUtils.calculateInSampleSize(imageSize, imageScaledSize, 1.0)

val sourceBitmap = BitmapFactory.decodeFile(imagePath, options)

var sobelScript: ScriptC_sobel? = null
var inputAllocation: Allocation? = null
var outputAllocation: Allocation? = null
var intermediateAllocation: Allocation? = null
var convolve3x3: ScriptIntrinsicConvolve3x3? = null
var renderScript: RenderScript? = null

val imageWidth = sourceBitmap.width
val imageHeight = sourceBitmap.height

renderScript = RenderScript.create(ApplicationContext.ApplicationContext())
inputAllocation = Allocation.createFromBitmap(renderScript, sourceBitmap)
val typeInBuilder = Type.Builder(renderScript, Element.F32_4(renderScript)).setX( imageWidth ).setY( imageHeight   )

// Allocation where to store the sum result (for output purposes)
val coefficientsGx = floatArrayOf(-1f, 0f, 1f, -2f, 0f, 2f, -1f, 0f, 1f)
val coefficientsGy = floatArrayOf(-1f, -2f, -1f, 0f, 0f, 0f, 1f, 2f, 1f)

intermediateAllocation = Allocation.createTyped(renderScript, typeInBuilder.create())

convolve3x3 = ScriptIntrinsicConvolve3x3.create(renderScript, Element.F32_4(renderScript))
convolve3x3.setInput(inputAllocation)
convolve3x3.setCoefficients(coefficientsGx)
convolve3x3.forEach(intermediateAllocation)

On this last line, program crashes with native error: 在最后一行,程序因本机错误而崩溃:

? D/NetworkController.MobileSignalController(0/2147483643): onSignalStrengthsChanged signalStrength=SignalStrength: 26 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte level=4
2302-2671/? D/NetworkController.MobileSignalController(0/2147483643): getMobileIconGroup(): 0
16440-17400/ A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0x76f458b4 in tid 17400 (AsyncTask #4)
16440-17398/ A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0x76f456d4 in tid 17398 (AsyncTask #4)
16440-17398/ I/libc: Another thread contacted debuggerd first; not contacting debuggerd.
16440-17399/ A/libc: Fatal signal 7 (SIGBUS), code 1, fault addr 0x76f45404 in tid 17399 (AsyncTask #4)
16440-17399/ I/libc: Another thread contacted debuggerd first; not contacting debuggerd.
16440-17396/ A/libc: Fatal signal 7 (SIGBUS) in tid 17396 (AsyncTask #4)
16440-17396/I/libc: Another thread contacted debuggerd first; not contacting debuggerd.
400-400/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
400-400/? A/DEBUG: Build fingerprint: 'samsung/j5xnltexx/j5xnlte:6.0.1/MMB29M/J510FNXXU2AQG3:user/release-keys'
400-400/? A/DEBUG: Revision: '4'
400-400/? A/DEBUG: ABI: 'arm'
400-400/? A/DEBUG: pid: 16440, tid: 17400, name: AsyncTask #4  >>> com.test.development <<<
400-400/? A/DEBUG: signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x76f458b4
400-400/? A/DEBUG:     r0 0000003b  r1 00000000  r2 b8ceb4a0  r3 76f458b4
400-400/? A/DEBUG:     r4 76f458b4  r5 9b68a7f8  r6 b8ceb4a0  r7 00000000
400-400/? A/DEBUG:     r8 0000003c  r9 76f459a4  sl 76f458b4  fp 76f45a94
400-400/? A/DEBUG:     ip b8cb3c14  sp 9b68a7b0  lr 00000001  pc 9cff66d8  cpsr 200f0030
400-400/? A/DEBUG: backtrace:
400-400/? A/DEBUG:     #00 pc 0002d6d8  /system/lib/libRSCpuRef.so
400-400/? A/DEBUG:     #01 pc 0002d68b  /system/lib/libRSCpuRef.so (_ZN7android12renderscript32RsdCpuScriptIntrinsicConvolve3x38kernelF4EPK24RsExpandKernelDriverInfojjj+122)
400-400/? A/DEBUG:     #02 pc 0001f1f5  /system/lib/libRSCpuRef.so
400-400/? A/DEBUG:     #03 pc 0001eb67  /system/lib/libRSCpuRef.so (_ZN7android12renderscript19RsdCpuReferenceImpl16helperThreadProcEPv+138)
400-400/? A/DEBUG:     #04 pc 00041813  /system/lib/libc.so (_ZL15__pthread_startPv+30)
400-400/? A/DEBUG:     #05 pc 00019315  /system/lib/libc.so (__start_thread+6)

com.test.development A/libc: Fatal signal 7 (SIGBUS) in tid 3368 (AsyncTask #4)
? E/audit: type=1701 msg=audit(1509449660.557:282): auid=4294967295 uid=10133 gid=10133 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=3371 comm=4173796E635461736B202334 reason="memory violation" sig=7

So the problem got solved by passing Script.LaunchOptions to convolve3x3.forEach function, limiting intersection over which kernel will operate. 因此,通过将Script.LaunchOptions传递给convolve3x3.forEach函数来解决此问题,从而限制了内核运行的交集。 Setting it within the range of the allocation did the job. 将其设置在分配范围内即可完成工作。

renderScript = RenderScript.create(ApplicationContext.ApplicationContext())
inputAllocation = Allocation.createFromBitmap(renderScript, sourceBitmap)
val typeInBuilder = Type.Builder(renderScript, Element.F32_4(renderScript)).setX( imageWidth ).setY( imageHeight  )
val launchOptions = Script.LaunchOptions()
launchOptions.setX( 0, imageWidth-1 )
launchOptions.setY( 0, imageHeight-1)
launchOptions.setZ( 0, 1 )

// Allocation where to store the sum result (for output purposes)
val coefficientsGx = floatArrayOf(-1f, 0f, 1f, -2f, 0f, 2f, -1f, 0f, 1f)
val coefficientsGy = floatArrayOf(-1f, -2f, -1f, 0f, 0f, 0f, 1f, 2f, 1f)

intermediateAllocation = Allocation.createTyped(renderScript, typeInBuilder.create())

convolve3x3 = ScriptIntrinsicConvolve3x3.create(renderScript, Element.F32_4(renderScript))

convolve3x3.setInput(inputAllocation)
convolve3x3.setCoefficients(coefficientsGx)
convolve3x3.forEach(intermediateAllocation, launchOptions)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 信号 7 (SIGBUS),代码 1 (BUS_ADRALN),故障地址 - Signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr Android Libgdx致命信号11(SIGSEGV),代码1,故障加法器0x0 - Android Libgdx Fatal signal 11(SIGSEGV) ,code 1, fault addr 0x0 Android 致命信号 11 (SIGSEGV),代码 1,tid 29092 中的故障地址 0x0 - Android Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 29092 安装缓存时,Apache Ignite bus_adraln错误 - Apache Ignite bus_adraln error during installation of cache java.lang.Error:信号11(SIGSEGV),代码10(?),故障加法器006e006f - java.lang.Error: signal 11 (SIGSEGV), code 10 (?), fault addr 006e006f TID 13934中的致命信号11(SIGSEGV),代码1,故障加法器0x40 - Fatal signal 11 (SIGSEGV), code 1, fault addr 0x40 in tid 13934 TID 7061(GLThread 42829)中的致命信号11(SIGSEGV),代码1,故障加法器0x28 - Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 7061 (GLThread 42829) 如何摆脱错误“致命信号 11 (SIGSEGV),代码 1,故障地址 0x70” - How to get rid of the error “Fatal signal 11 (SIGSEGV), code 1, fault addr 0x70” Android致命信号7(SIGBUS) - Android Fatal Signal 7 (SIGBUS) A/libc:致命信号 11 (SIGSEGV),代码 1 (SEGV_MAPERR),tid 8890 (RenderThread) 中的故障地址 0x20,pid 8833 - A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 8890 (RenderThread), pid 8833
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM