Hi, John

Actually, the amount of available GPU memory reported is not exactly accurate 
on Android device. Unlike Desktop GPU, there is no straightforward way to query 
available gpu memory. On Android device, its value is heuristically calculated 
from the available physical RAM (yes, RAM) and Davik VM, and make sure it is in 
a pre-defined range. As a result, it is possible that you force to set 
available gpu memory to 100MB but only 8MB is reported.

Right now let's focus on the issue you encountered, not the estimated amount of 
gpu memory. The issue your encountered when using Crosswalk is, the behavior of 
your app is not consistent cross multiple device, e.g. crash on some device, I 
suspect a bug in canvas is exposed by your app.

Would you like to share your source code to us to diagnose the root cause? If 
you are hesitant to do that,  then capture the output from adb logcat after 
launching your app, especially for the crash point. It is recommended to use 
the latest  Crosswalk canary version 
https://download.01.org/crosswalk/releases/crosswalk/android/canary/10.39.227.0/
 to try it again.

Regards
Hongbo
________________________________
From: John Harrison [[email protected]] on behalf of John Harrison 
[[email protected]]
Sent: Sunday, October 19, 2014 3:51 AM
To: Min, Hongbo; [email protected]
Subject: Re: [Crosswalk-help] stability of Crosswalk across multiple devices 
for canvas-heavy app

Thanks for the detailed response. My responses are interspersed with yours 
below. To make them easier to spot I color-coded them.

On 10/15/2014 12:02 AM, Min, Hongbo wrote:

Hi, John

Thanks for your elaborate report. It is very informative! See my comment as 
below.



-----Original Message-----
From: Crosswalk-help [mailto:[email protected]
project.org] On Behalf Of John Harrison
Sent: Monday, October 13, 2014 10:15 AM
To: 
[email protected]<mailto:[email protected]>
Subject: [Crosswalk-help] stability of Crosswalk across multiple devices for
canvas-heavy app

I recently completed a Cordova app which runs stable and fast on iOS7 and
iOS8 devices. It runs in Webview for Android devices but is slow, so I
migrated it over to Crosswalk. The results were initially promising as
Crosswalk 8  ran fast and stable on the tested device. However, I found the
results were different on other Android devices. After trying 6 different
versions of Crosswalk I finally released the app using Crosswalk 7.36.154.12 as
it seemed the most stable on the tested devices. However, the app is still not
stable on all Android devices I have tested on. Below are my notes for each
version I tried and the results I found on the various devices.


[hmin] The work you did is very helpful for us to continuously improve 
Crosswalk. Thanks a lot again!



The app manipulates multiple Canvas elements and relies heavily on GPU
hardware acceleration. I'd love to find a way that it might be stable on all
Android 4.x devices using Crosswalk. I'd love some advice as to what I might
try next or what tests might be helpful to the Crosswalk developers.

And...I've tried these Crosswalk versions with every GPU and memory flag
under the sun. Unless I shut off hardware acceleration for the canvas
element or other hardware acceleration (which results in poor performance)
the behavior is the same:

6.35.131.13
 - appeared stable with quick test on LG G3 Android 4.4.2
 - GPU reports only 8MB available on Motorola Droid Mini Android 4.4.4
according to --show-fps-counter. This causes poor performance as the GPU
memory needed is often exceeded. Crosswalk versions 8,9,10 do not have
this problem with this device as these versions report over 100MB of GPU
memory on this same device.


[hmin] In Crosswalk 6, the max available GPU memory is hard-coded to 8MB in 
GpuMemoryManager, so it doesn't reflect the real number on the device.  See the 
code 
https://github.com/crosswalk-project/chromium-crosswalk/blob/crosswalk-6/35.0.1916.17/content/common/gpu/gpu_memory_manager.cc#L81.
 But from Crosswalk 8, 9, 10, the hard-coded number is changed to 256MB, 
https://github.com/crosswalk-project/chromium-crosswalk/blob/crosswalk-9/38.0.2125.23/content/common/gpu/gpu_memory_manager.cc#L104.

Same as Chromium, Crosswalk allows you to force to set the available gpu memory 
by passing '--force-gpu-mem-available-mb' command line option. With this 
option, you can instruct Crosswalk to set the total amount of memory that can 
be allocated for GPU resources when rendering the page. You may want to use 
this option to increase the amount of gpu memory to see if the performance is 
improved accordingly.

Since you are using Cordova-Crosswalk to package an app, the usage of command 
line option is a bit tricky if make_apk.py script is not used. For your 
information, you can follow the following instructions to add command line 
options by manual:
1. Create a new empty file named as xwalk-command-line in <assets> folder;
2. Add "xwalk --force-gpu-mem-available-mb=100' to xwalk-command-line file.

Re-package the app using cordova toolchain, and you will get the command line 
option works.

Testing on Xwalk 7, unfortunately this didn't work. I added in my 
xwalk-command-line:
xwalk --force-gpu-mem-available-mb=100 --show-fps-counter

I know the command line is being read because the fps counter shows (and does 
not show if I remove the line). However the amount of memory reported as MAX 
still is 8MB.


 - If wifi/mobile network is not available exhibits strange erratic behavior in
the app. This is in spite of the fact that the app does not use wifi/mobile
network.


[hmin] Do you remember the error message? Is it saying something like 
"application ... server timeout ..."?

I don't remember the error message, but this was on Xwalk 6 so it might not be 
worth our time since it does not seem a problem with later versions. If it is 
helpful to you I can migrate back to Xwalk 6 and catch the error.

7.36.154.12 and 7.36.154.13:
 - exact same behavior as 6.35.131.13 except:
  - no issue with wifi/mobile
  - runs but is not stable on LG G3 Android 4.4.2. Erratic crashes. Android log
for crash unknown.


[hmin] If you app is using canvas element, and you also turn on 
ignore-gpu-blacklist option, it is very possible that the app would crash by 
accident since it may encounter a bug in gpu driver.

I tried that. The behavior is the same. The only thing that makes the app 
rock-solid with no crashes is the command line --disable-accelerated-2d-canvas 
but then the performance is laggy.

8.37.189.12, 9.38.208.1, 10.38.219.0
 - app immediately crashes on LG G3 Android 4.4.2. Android log reports GPU
Parse Error 2.


[hmin] Maybe it triggers a bug in gpu driver if ignore-gpu-blacklist.



 - strange delays of up to several seconds at a time on x86 Asus ME302
running Android 4.3. Also is not fully stable (sometimes crashes at erratic
times. Log unknown. Note: app has both x86 and ARM Crosswalk so
Crosswalk is native x86 code, not running in ARM emulator.)
 - GPU reports 100MB available on Motorola Droid Mini, which is stable and
runs fast and well. (Why does this same device report only 8MB available on
Xwalk versions 6 and 7?)


[hmin] The amount reported by show-fps-counter is a number hard-coded by 
Crosswalk (Chromium), it varies between different versions, see the above 
explanations.
There are 2 categories showed in FPS head-up-display: USED and MAX. The USED 
means that the total bytes allocated for page rendering, while the MAX means 
the total bytes of GPU memory budgets. Is the 100MB reported by USED or MAX 
category?

100MB was in the MAX category.

The app is built on Cordova 3.6.3-0.2.13 and uses the following plugins:

org.apache.cordova.console 0.2.7 "Console"
org.apache.cordova.device 0.2.8 "Device"
org.apache.cordova.file 1.0.1 "File"
org.apache.cordova.inappbrowser 0.5.2 "InAppBrowser"
org.apache.cordova.media 0.2.12 "Media"
org.apache.cordova.splashscreen 0.3.3 "Splashscreen"
org.apache.cordova.statusbar 0.1.7 "StatusBar"

Thanks in advance for any help,

-John
_______________________________________________
Crosswalk-help mailing list
[email protected]<mailto:[email protected]>
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help


_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to