I'm intermittently observing strange graphics artefacts in my app, as shown below. This is a screengrab from a Samsung Galaxy S3. I have only observed it on this particular phone. I have run the app on a Samsung Galaxy Tab S4 and an HTC One, and never observed this issue on either - although admittedly I do mainly use the S3 for development.
I considered that the issue might be some sort of concurrency clash in drawing to the Canvas (I'm using the basic Android rendering methods, no OpenGL or anything), since I can clearly recognise the repeating units of other UI elements, so I synchronized all the code which draws to or interacts with the Canvas and I'm still observing it happen.
It does clear itself up after around 30-90 seconds, which may be due to a regular scheduled memory cleanup operation it performs - so perhaps this is a manifestation of low available mem?
If I had enough rep I would stick a pretty big bounty on this. Any help appreciated. Hopefully someone recognises this particular problem.
Apply hardware layers:
setLayerType(View.LAYER_TYPE_HARDWARE, null);
Related
my first android game it's almost done, and I'm on the way to publish it on the play store.
Today I tested it on some friends phone and it worked on all except for a samung a5. On this phone the meshes flicker, apper and disapper and look deformed. This when playing game where I use a lot of frame buffer, in the main menu where there is a simpler animation everything look right.
The game is developed with libGdx and use some custom shader. I've tested it on 8 other different device without no issue (excepect for low frame rate on samsung galaxy tab s4).
I ask yours advise:
1) what should I start to check to find the problem with a5?
2) do you think I should delay the publication until the bug it's solved ora I should publish it excluding A5 ( or maybe all devices with similar GPU) from compatibility list?
My big problem is that at the moment I don't have the device with me (it's the personal phone of a friend of mine...) and probably I will have it for only a limited amount of time, so I want to be preparated to avoid to lock the device for too much time to my friend.
Thanks to all!
First, I'd make sure you don't have any OpenGL errors - add calls to glGetError and validate frame buffers and shader programs, you can do this without the device and adding extra asserts like this is always worthwhile (assuming you don't already have them). Next, try using the tools provided by the GPU manufacturer. In your case the snapdragon profiler. To minimize the time you'll be using your friends device, get the tools installed ahead of time and if you have access to another Qualcomm device, then use that to familiarize yourself with the software. With luck the cause of problem might become immediately obvious. If not, then it's just a binary search of disabling parts of your code until you narrow it down to a particular shader/draw call, then examine/tweak that to figure out what bit is going wrong.
That's a tough call. If it's a driver bug, then it might only occur on particular revisions. Some A5 devices might work if they're on different versions of Android from your friends device. That said, the A5 is relatively recent and Samsung/Qualcomm drivers tend to be pretty solid IME, so it's more likely an error in your code that happens to only be exposed on certain devices. Personally I would delay release unless your release strategy is timing sensitive, from the limited data you have, your game doesn't work on >10% of devices.
Just wanted to share an experience I had to see if anyone came across such issue, if they found the cause and more importantly how they fixed it.
The problem is pretty simple: while debugging native code on a Nexus 6, which as the Adreno 420 GPU, eglSwapBuffer could crash under certain circumstances when using Android 5.1 (5.0 worked perfectly).
Since I could not repro it I am unable to tell you what went wrong. According to the documentation, elgSwapBuffer calls internally glFlush; and so if I call glFlush before calling eglSwapBuffer all of a sudden it works perfectly.
My guess is that the driver does not flush properly thus crashing when swaping the buffers.
Any comments on this?
Cheers,
D
I'm having the same problem and I can reproduce it. It happens obviously because it runs out of stack memory due to deep nested loops in the rendering process.
Android Lollipop 5.1: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) / when using lot of nine patch graphics
I've already reported it to the google issue tracker:
https://code.google.com/p/android/issues/detail?id=163100
Update: Meanwhile I found a way to work around this issue. It's definitely not a long time solution, but for the moment, it's just the best available to stop my apps from crashing.
I disabled GPU rendering for particular graphic layers. It slows the drawing down a bit, but not significant.
So the nightmare is over for now, but I still think, this issue must be fixed on the driver itself. It cannot be that something that worked perfect with 5.0.2 and below, immediately stops to work with 5.1.
I have seen some weird behavior on the N6 as well, and while I cannot rule out app bugs, it looks to me like the Adreno driver is to blame.
Specifically, in landscape mode, our GLSurfaceView only renders one half of it's content, but occasionally flickers all of it. And with certain scenes being rendered there is intermittent flickering. In a case of extra weirdness, I have seen one half of the screen completely freeze, stuck on app content, even after returning to the launcher via the home button. It appears kind of like it would if it used multi stream transport and one of the streams was getting lost.
I followed the documentation (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization) to initialize opencv in static initialization and it is working well so far on my phone.
However, some of my friends who helped testing my app, says the performance is very bad when they use the 'photo enhancement' feature, where I used openCV to apply some adaptive threshold filtering to sharpen the text in the images (example here: How to use OpenCV to process image so that the text become sharp and clear?). I still couldn't figure out why is that so.
Phone models that I tried it on:
1) My phone (samsung galaxy s3) - smooth (instant)
2) friend no.1 (samsung galaxy s2) - smooth (instant)
3) friend no.2 (samsung galaxy s2) - super laggy (takes few seconds for UI to regain responsiveness)
4) friend no.3 (htc one) - super laggy (takes few seconds for UI to regain responsiveness)
5) friend no.4 (samsung galaxy s4) - super laggy (takes few seconds for UI to regain responsiveness)
I recalled that my phone and friend no.1's phone installed older version of my app before, where the app was still using async initialization method (and have to install OpenCV manager from play store in order to use) and I can't think of anything different between the phones tested above..
Does anyone has similar experience? Any advice on what to look for?
There's a number of reasons why this could be happening. To make a fair evaluation you would have to restore each device to it's factory settings and execute profiling/benchmarking tools to figure out what's going on.
For instance, the phones that were found to be super laggy:
Could have too many widgets running on your homescreen, thus causing the device’s performance to slow down;
Could be using different Android versions;
Could be using Live Wallpapers (which require extra CPU cicles to run);
Generally speaking, a device could be running other background processes that are stealing CPU processing away from your app.
There is an official document for Android developers with performance tips. It's pretty interesting to read. They recommend a few tools for measure the performance of an application:
Caliper for Java microbenchmarking;
Traceview for profiling;
Systrace to analyze how the execution of your application fits into the larger Android environment, letting you see system and applications process execution on a common timeline.
There's also a nice article on vogella.com about analyzing Android performance issues. It's a must-read!
I have an OpenGL ES 2 app running on Android. I have tested on a few devices:
Samsung Galaxy S2
LG Optimus G
HTC One X
Kindle Fire
Kindle Fire HD
And the app runs as expected. However, there is a lingering issue on my Samsung Galaxy S3. In my demo, I render a bunch of spheres. I can also pan the camera around by touching and dragging my finger on the screen.
What I notice is "ghosting" when I move the camera. It's difficult to describe, but I can see the previous outlines of the sphere as I move the camera. And, I can continue to see the previous outlines as the camera moves. I don't see all the previous outlines -- only the last few (it's difficult to quantify things here). And, I only see the outlines within the sphere -- as far as I can tell, the previous outlines cease to exist outside of the sphere.
However, once the camera stops, the outlines catch up and disappear within ~1s. Simply put, when things are stationary, everything renders correctly.
I recently had some texturing issues (related to mipmapping) and I solved them the other day. The problem and solution are outlined here:
Black Artifacts on Android in OpenGL ES 2
Could my texturing fix be related to this? I realize that I'm leaving out A LOT of details, but I'm wondering if the symptoms are enough to go on? Any ideas?
Thanks.
Additional details:
The ghosting does not show up when taking a screenshot using the NDK.
A photo of the problem:
A temporary solution is on your phone, under Developer options, check the box to "Disable hardware overlays."
I'm not yet sure if there's a way to force this behavior when running your app.
Im testing my new game prior to release and i have found that on some devices the Z positions seemed to be mixed up in some cases and objects that should appear on top were appearing underneath.
I'm running opengl es 1 and it runs perfectly on my Samsung Galaxy S2 (and all the samsung devices i tested on) but went wrong on a HTC Desire.
Does anyone have any ideas?
Can you provide us with some pictures and source code? Common depth buffer problems cause some banding problems but your problem seems more related to some default driver state that is set differently value depending on which hardware are you running on.
I suggest you to generate a very simple example and start from the scratch until you find where is the problem, I don't think we can help you with so little information.
Hope that helps.