5

This explains VSYNC, but the pace is very fast, and i am unable to find any other good resource to understand this topic.

What i have understand is this;

VSYNC happens at every 16ms, and all of the frame components INPUT ANIMATION LAYOUT RECORD DRAW & RENDER only happens 1 in this time, so with VSYNC the frame rendering is synchronized, and it restricts frame from redrawing in the specified time.

Kindly guide me if this understanding is correct or not.

dev90
  • 7,187
  • 15
  • 80
  • 153

2 Answers2

4

VSYNC is vertical sync. Its a term common to TVs, monitors, displays, etc. You can basically think of it as the refresh rate, its how often the display is actually refreshed. The display can only update on the VSYNC signal, so changes to the display are basically batched until the next VSYNC.

The term comes from old school TVs where the VSYNC would actually change 1 row at a time from top to bottom of the TV. That's why on some old tube TVs you could see a bar of change moving down the screen.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • and `VSYNC` occurs after every `16ms`, and in single `VSYNC` there can be multiple frames rendered? Let say i have 8 buttons in a view, there is no animation so they will draw in `16ms`. In this case `VSYNC` will perform only once, or If its a complex view `Facebook` app, then how `VSYNC` distribute frames rendering position, and Thanks for such a nice explanation. – dev90 Aug 31 '17 at 19:44
  • 1
    Basically, think of it this way from a very high level- when you draw, you're actually drawing to a bitmap in memory, whether you think you are or not. Every 16ms, Android takes that bitmap and dumps it to the device. If you drew 10 frames in that 16ms, only the last will be drawn. Where you're drawing to on screen doesn't matter, its all buffered. (If you were working at a hardware layer, that may not be true. But on a modern OS nobody above the device driver layer has to consider that). – Gabe Sechan Aug 31 '17 at 20:03
  • I did't understand this part, `If you drew 10 frames in that 16ms, only the last will be drawn` only the last frame will be drawn? – dev90 Aug 31 '17 at 21:09
  • 1
    Drawn to the screen. If you managed to draw 10 frames in the 16 ms, only the last frame would make it to the screen. So drawing faster than VSYNC is a waste. – Gabe Sechan Aug 31 '17 at 21:40
2

VSYNC is synchronization signal. It synchronize the display pipeline. Display pipeline contains the apps rendering & extra attributes to present image on display.

This VSYNC synchronization signal triggers based on FPS(Frames Per Second) configured for display. Assume the display is configured for 60fps i.e. 60 times display will be refreshed with new frames per second. So VSYNC signal will trigger after every 16.66ms (1/60 s).

SomeOne
  • 497
  • 4
  • 9