How to Fix GPU issues on Android

At times, Android device apps may run more than needed and execute long thread and the GPU Operations too. The app may also run into issues rendering its user interface. But now that you are here, your issues will be fixed. In this article, we are sharing with you all the ways through which one can fix GPU Issues on Android by debugging GPU overdraw and profile GPU rendering.

Profile GPU Rendering Speed

The Profiler for GPU helps in rendering Speed of GPU. The profiling apps give us a visual representation of the time needed to render frames of the user interface window relative to the benchmark of 16 ms per frame.

The Profiling tool will help you identify when GPU is defeated and tires to draw pixels and burdening the system by huge overdraw and thus help in fixing GPU issues.

If the GPU rendering is forced, it will offload things like – buttons, text, 2D Graphics, etc to GPU. That is, while using the device, you will feel minimum lagging and the UI Animations will be better. However, this will apply to only the 2D Apps.

The Profiling app also does not work with apps using NDK since the system pushes framework messages to the background when the OpenGL takes complete context. At such times, one can use the GPU manufacturer’s profile tool.

For the GPUs that are less powerful, the available fill rate can be low. The GPU may take more time to process new commands since the number of pixels needed to draw a frame increases. Thus, the GPU asks the rest of the system to wait for it to catch up.

How to enable the Profiler Tool

Prerequisite

  • One can use and enable the Profiler tool on the Android device that is running n Android 4.1 or above.
  • Enable Developer options.

Step 1. Go to the Settings of your Android device.

Step 2. Choose the tab of Developers Option.

Step 3. On the monitoring screen, choose Profile GPU Rendering.

Step 4. In this section, select ‘On Screen as bars’ option so as to overlay graphs on the device’s screen.

Step 5. Now you can open the app that you are willing to profile.

How to Inspect Output?

When you have a GPU rendering Profile graph, consider the things given below –

  • Every color bar indicates a stage of the rendering pipeline.
  • The tool displays a graph for every visible app.
  • The constituent number differs as per the API level of the device.
  • The 16 MS Threshold is represented by the horizontal line. For achieving 60 frames per second, the vertical bar has to stay below this line. There will be pauses in animations whenever the bar surpasses this line.
  • The frames that are exceeding 16 MS threshold are highlighted by the tool in the form of making the related bar less transparent and wider.
  • The height of every vertical bar represents the time required to render and each of the vertical bars along the horizontal axis denotes a frame.

Given below is the description of the rendering stage according to the color component of the bar of CPU rendering graph in Android 6.0 and above –

fix gpu issues

  • Orange color – The rendering stage described by orange color is ‘Swap buffers’. This shows the time for which the CPU has been waiting for the GPU to let its work finish and catch up. As the bar grows tall, it indicates that the app is consuming too much of the GPU.
  • Red color – Red bars indicate ‘Command issues’. The color denotes time taken by 2D Android rendered to issue commands to OpenGL for drawing and redrawing display lists.
  • Light Blue color – The rendering stage indicated by this color is ‘Upload’. This shows the time taken to upload bitmap info to GPU. Large the segment more is the time required to load large graphics.
  • Dark Blue color – The rendering stage shown by Dark blue color is ‘Draw’. This shows the time required to create and update the display list of the view. Taller bar means more custom view drawing or more work.
  • Turquoise 1 color – The rendering stage described by orange color is ‘Layout or Measure’. This shows the time dedicated to OnMeasure and OnLayout Callbacks in the hierarchy.
  • Turquoise 2 color – The rendering stage described by orange color is ‘Animation’. This denotes the time required to evaluate animators that ran in the frame. An increasing part of this segment directs that an app might be using a custom animator showing bad performance or needless work.
  • Turquoise 3 color – The rendering stage described by orange color is ‘Input Handling’. This indicates the time that app is spending in executing code inside an input event call back. If this grows, it shows that the app spends a lot of time in processing the user input.
  • Turquoise 4 color – The rendering stage described by orange color is ‘Vsync Delay or Misc Time’. This shows the time an app has been donating to execute operations in two consecutive frames. It also shows that a lot of processing is going on in the user interface thread that can offload to another thread.

Here are the color bar components for Android versions between 4.0 and 5.0. Note that for Android versions below 4.0, there are only 3 components – Orange, Red, and Blue.

  • Orange Color – The rendering stage described by orange color is ‘Process’. This shows the time for which the CPU has been waiting for the GPU to let its work finish and catch up. As the bar grows tall, it indicates that the app is consuming too much of the GPU.
  • Red color – Red bars indicate ‘Execute’. The color denotes time taken by 2D Android rendered to issue commands to OpenGL for drawing and redrawing display lists. As the time for displaying each of the lists to execute increases, the height of the bar increases.
  • Purple color – The rendering stage indicated by this color is ‘XFer’. This shows the time taken to upload bitmap information to the GPU. Larger the segment more is the time required to load large graphics. This segment is not visible on the devices that run on Android 4.0 and below.
  • Blue color – The rendering stage shown by Dark blue color is Update. This shows the time required to create and update the display list of the view. As the bar grows in height, it means more custom view drawing or more work in the methods of OnDraw.

How to Visualize GPU Overdraw?

Overdraw is a situation that happens when the app uses the same pixel for more than once. Visualize GPU Overdraw is a feature from the Developer options to identify overdraw by the color coding User interface. Basically, Visualize GPU overdraw means one can see where the app is working more than required.

Thus, you can see and check when an app works more than required and fix GPU issues. In case you are looking for a way to fix any of your GPU issues, this is the method that turns out to be most helpful –

Step 1. Go to the settings of your Android device.

Step 2. Choose the tab of Developers Option.

Step 3. Over there, scroll to the bottom until you see – Hardware accelerated rendering section and choose ‘Debug GPU Overdraw’.

Step 4. In Debug GPU Overdraw section, choose ‘Show overdraw areas’.

The amount of overdraw is shown in colored components that include the following colors and related overdraw times –

  • Original Color – No overdraw.
  • Blue Color – Overdraw happens 1 time.
  • Green Color – Overdraw happens 2 times.
  • Pink Color – Overdraw happens 3 times.
  • Red color – Overdraw happens 4 or more times.

Some of the overdraws are unavoidable. However, you can reduce most of them with the help of Debug GPU Overdraw Tool and Profile GPU Rendering Tool. To fix overdraw, you can remove unnecessary background in layouts, reduce transparency or flatten the view hierarchy.

Conclusion

I hope the article was useful to fix GPU Issues. In case you are still facing any issues, do let us know in the comment box.

 

Leave a Comment