Water Worlds May Be Common in the Universe

Researchers presenting at the Goldschmidt conference in Boston are arguing that the number of planets with significant amounts of water in their atmospheres or crusts may be much higher than…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Understanding GPU overdraw

Most basic applications will work as smooth as we expect them to be, but while building complex apps, the UI gets complex and things like animation comes in to the picture, and the application starts lagging, let’s understand what happens when we say the application lags.

Most phone’s display refresh rate is 60Hz. Which means an activity will be redrawn 60 times per second. Android systems draw method is going to get called every 16ms(1000ms/60Hz). Every 16ms system is going to ask for a new frame buffer(picture).

If the app’s UI is not performant, drawing frame buffer might take longer than expected and in such scenario Frame drops happen and user sees the same state of the activity for a longer time. As the above picture the activity is getting drawn at every 16ms, if the frame buffer(picture) is not ready at the moment of draw call, the system won’t update the activity and user would see the same state for extra 16ms, thus the application UI is laggy.

There could be numerous reasons for application to be laggy, such as doing heavy operations on UI thread, having nested layouts, overdrawing same pixels, etc.

We would know more about what Overdrawing is for now. When system draws the same pixel more than once, that event is an Overdraw. Overdraws are unnecessary from end user perspective cause the system is drawing something which the user would not be able to see. For example, having transparent background, or a card stacked on each other. Most part of the card stacked would be under some other card and it will make the system draw 2 layers. Generally 1 or 2 overdraws are fine but sometimes it gets unavoidable to reduce overdraw for various reasons.

How can we detect the overdraw?

We can easily inspect the overdraw by enabling GPU rendering overdraw feature in the Developer options. The path to the setting would roughly be —

Or you could just search Debug GPU overdraw in settings app.

After enabling the overdraw option the screen would look colourful as below and it will show multiple colours. Let’s also understand what those colours mean.

The white space, where there are no adverse colour present tells the pixels were drawn only once.

Blue colour tells the pixel was overdrawn one time

Green: Overdrawn 2 times

Pink: Overdrawn 3 times

Red areas are overdrawn 4 or more times

Now we know the problem and know how to detect and read the problem, let’s know the possible ways to reduce overdraw.

Add a comment

Related posts:

4 Steps To Find A New Career With Balance

4 steps to find a new career with balance for happiness and health. How to find work life balance with a career change. Free downloadable worksheets

The Woman Responsible For Sin And Evil in Medieval Europe

Churches became very influential in medieval Europe. It was necessary to perform church rites from birth to death. Its actions were also involved in daily life. There were severe punishments for…

Hush

You do not have to be active in a moment to make it valid. In fact, you do not give any moment in time its validity. There is much good to see and to hear and to feel; not all good is to be done. You…