dequeueBuffer:不设置缓冲区数就无法使多个缓冲区出队


123

Android 4.4.2 Moto X 2013Rhomobile 5.0.2WebView应用中遇到以下错误。该应用使用SDK 19和编译minAPI 17

经过研究,看来这是一个问题Snapdragon 800 / Adreno GPU devices

这里这里Google问题追踪器上此问题的链接

禁用硬件加速并不是真正的选择,因为它会使WebView非常缓慢。

由于错误是:

dequeueBuffer: can't dequeue multiple buffers without setting the buffer count

如何在com.rhomobile.rhodes.RhodesActivity中设置缓冲区计数?

11-08 18:28:31.227: I/SFPerfTracer(238):      triggers: (rate: 0:0) (423387 sw vsyncs) (0 skipped) (0:361861 vsyncs) (2:863582)
11-08 18:28:31.328: W/Adreno-EGLSUB(4749): <DequeueBuffer:593>: dequeue native buffer fail: Unknown error 2147483646, buffer=0x61213afc, handle=0x0
11-08 18:28:31.331: W/Adreno-EGLSUB(4749): <SwapBuffers:1343>: Invalid native buffer. Failed to queueBuffer
11-08 18:28:31.331: W/Adreno-EGLSUB(4749): <updater_thread:456>: native buffer is NULL
11-08 18:28:31.346: E/BufferQueue(238): [com.myapp.myapp/com.rhomobile.rhodes.RhodesActivity] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
11-08 18:28:31.346: W/Adreno-EGLSUB(4749): <DequeueBuffer:593>: dequeue native buffer fail: Invalid argument, buffer=0x61213afc, handle=0x0
11-08 18:28:31.347: W/Adreno-ES20(4749): <gl2_surface_swap:43>: GL_OUT_OF_MEMORY
11-08 18:28:31.347: W/Adreno-EGL(4749): <qeglDrvAPI_eglSwapBuffers:3596>: EGL_BAD_SURFACE
11-08 18:28:31.347: W/HardwareRenderer(4749): EGL error: EGL_BAD_SURFACE
11-08 18:28:31.352: W/HardwareRenderer(4749): Mountain View, we've had a problem here. Switching back to software rendering.
11-08 18:28:31.478: D/qdgralloc(4749): Invalid gralloc handle (at 0x0): ver(-1/12) ints(-1/12) fds(-1/2) magic(????/gmsm)
11-08 18:28:31.478: W/GraphicBufferMapper(4749): lock(...) failed -22 (Invalid argument)
11-08 18:28:31.478: W/Surface(4749): failed locking buffer (handle = 0x0)
11-08 18:28:31.531: E/ViewRootImpl(4749): Could not lock surface
11-08 18:28:31.531: E/ViewRootImpl(4749): java.lang.IllegalArgumentException
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Surface.nativeLockCanvas(Native Method)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Surface.lockCanvas(Surface.java:243)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2466)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl.draw(ViewRootImpl.java:2440)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2284)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1914)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1024)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5796)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Choreographer.doCallbacks(Choreographer.java:574)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Choreographer.doFrame(Choreographer.java:544)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.os.Handler.handleCallback(Handler.java:733)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.os.Handler.dispatchMessage(Handler.java:95)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.os.Looper.loop(Looper.java:136)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at android.app.ActivityThread.main(ActivityThread.java:5102)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at java.lang.reflect.Method.invokeNative(Native Method)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at java.lang.reflect.Method.invoke(Method.java:515)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-08 18:28:31.531: E/ViewRootImpl(4749):      at dalvik.system.NativeStart.main(Native Method)

1
您找到解决此问题的方法了吗?
Massimo 2016年

6
否,但值得庆幸的是,在Android 5+中,WebView现在可以通过GooglePlay进行更新,并且这个问题正在逐渐消失。
fnllc

Answers:


1

如此处所示,这是内存不足的问题:

11-08 18:28:31.347:W / Adreno-ES20(4749)::GL_OUT_OF_MEMORY

android.view.Surface正在进行更多更新,GPU便无法处理。我不确定您是否可以尝试赶上这个。
我还相信,在许多没有崩溃的设备上,用户偶尔会遇到UI腿的问题。

几年前,我遇到了类似的问题。就我而言,主要是腿,但我认为问题是相同的。

为了解决这个问题,我添加了一个计数器来测量帧率。我看到帧速率很高,但是突然之间帧速率严重下降,因此我应用了一种平衡逻辑来搜索不会出现的最高FPS。

  • 以60 FPS开始
  • 如果是腿,请将FPS除以2
  • 如果不是,则将其设置为上一个值和当前值之间的平均值。
  • 重复直到你快乐;)

基本上,这是对完美FPS的二进制搜索。

对于您来说,这比较棘手,因为您会遇到崩溃的情况,因此您将必须保留FPS计数器,并且在搜索时要格外小心。

将FPS日志发送到您的服务器。一旦有了足够的数据,每个设备模块的FPS凝视点就可以变得更聪明。

至于将您的手放在WebView SurfaceView上,我想这也不是一件容易的事,但是我们谈论的是Android 4.4.2,因此反射无所不能:)

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.