What is VSync

Source: Internet
Author: User

VSync is the abbreviation of the vertical period (Vertical synchronization). The main idea is to set your FPS and display refresh rate up to the same time. The aim is to avoid a phenomenon called "tearing". I will describe these details again below.


Each CRT display has its own refresh rate. The unit is Hz. The value is the number of times the monitor updates the screen per second. Different displays support different refresh rates at different resolutions. It can range from low to 60 high to 100. Note that it is not the FPS mentioned in your game. Assuming you set a specific refresh rate, the monitor will always refresh the screen at that rate. Even the picture does not change whatever. The liquid crystal display is different. Every pixel of the LCD will always be lit when told to change. They don't need to be refreshed. However, because of the VGA (or DVI) working principle, the LCD has to be from the display card at a certain rate to get new pictures. This is even though the LCD does not have to be updated, but he still has his own refresh rate.


I think everyone here is clear about FPS. It shows how many images the card can depict per second. This is obviously the higher the better. However, for a high-speed game, your FPS is very difficult to keep the same number, and he will change as you show the complexity of the picture that the card is about to depict. So the tearing of the picture took place.
The so-called "tearing" is a picture separation phenomenon, like you take a picture, in the rotation of a photo, and then cut the two photos from the middle, with a picture of the top half with a second half of the next part of the butt up. The resulting portrait, though similar, is distinctly different in the upper and lower halves. This is called the tearing of visual reality. It is not always separated from the middle, it may be near or below it, the separation point may move up or down the screen, or it may move back and forth between two points. (Translator: The author of the original text is really verbose, in fact is the picture moving faster, the picture looks like two sections.) This phenomenon is afraid to play the game have seen it).
Why is this happening? Let's give a specific example. Let's assume your display's refresh rate is 75Hz, you're really playing your favorite game, and you now have 100 fps. This means your monitor updates 75 times per second, and your display card updates 100 times per second, 33% faster than your monitor. This means that during the time your display is updated, the display card depicts the 1+1/3 screen. That way, when the screen is displayed, the 1/3 image will cover the top 1/3 of the full screen. The next time the image is refreshed, the display card will depict the remaining 2/3 and the new 2/3 screen. This way, because the screen update can only keep up with the screen update of 2/3, so that the top of the image 1/3 or the lower 1/3 will not fit with the rest of the picture. Assuming that the picture changes are unlikely to be noticeable, but suppose you look around at a high speed it will be obvious.

Today, a very common misconception arises. Some people think that the solution to the problem is to simply set a FPS limit so that FPS does not exceed the refresh rate of the display, so that the card will not exceed 75FPS, so that it can be. Are you sure? Wrong!


Before I explain why, let me give you a double cushion. A double cushion is a way to mitigate tearing problems, though not entirely. Basically, you have a display buffer and a fallback buffer. When the display is to display the screen, it will "eject" the display from the display buffer. The display card depicts another new picture in the backup buffer, and when the painting is finished, the new screen is tested into the display buffer. However, this process takes time, assuming that the display's refresh is carried out during the copy process, the display is still a "torn" picture.


VSync solves the problem by establishing a provision that does not allow images in the fallback buffer to be copied to the display buffer before the display is refreshed. If FPS is above the refresh rate, there is no problem. After the backup buffer update is complete, the system is in a wait state. When the display is refreshed, the backup cache is checked into the display cache, and the display card is able to draw a new screen in the fallback cache, which is very effective in limiting your FPS to the refresh rate of the display.

This looks good, but let's look at a different example. Let's assume you've played the last level of your favorite game, and this game has a very good image. Your monitor's refresh rate is still at 75. But your FPS is now only 50, 33% lower than the refresh rate. This means that every time the display refreshes the image, your card can only draw 2/3 of the next frame. Let's see how it works. The display has just been updated, the first frame of the screen has been copied to the display buffer, the second frame of the screen 2/3 is written to the backup buffer, then the display again refreshed, it will be the first time from the display buffer to extract the first frame of the screen. Then show the remaining part of the second frame that the card has begun to complete. But it has to wait, and it will not be uploaded until the next refresh. The display is refreshed again, the monitor has to extract the first frame from the display buffer for the second time, then the second frame is written to the display buffer. The display card is written to the third frame in the fallback buffer 2/3. Wait until the display refreshes, the first time from the display buffer to extract the second frames of the screen, showing the card has begun to complete the remaining part of the third frames. And then the second time from the display buffer to extract the second frame of the screen, and then the third frame of the screen is written to the display buffer. So the analogy. So 4 times the display refresh, we can only to 2 frames of the picture. Assuming that the refresh rate is 75, we can only get 35 fps. It is very obvious that this value is lower than the 50FPS that the display card can take. This is mainly due to the display card must be in the painting backup buffer to waste time. In this process, the screen on the backup buffer cannot be copied to the display buffer. Theoretically, the double-buffered vsync,fps will be a set of discontinuous integers, which equals the refresh rate/n,n is a positive integer. That is, assuming that your refresh rate is 60hz, the FPS you can get is just 60,30,20,15,12,10 and so on. You can notice that 60 to 30 is a pretty big gap. Just the FPS of the display card from 60 to 30, you can say that the real FPS will only be equal to 30!


Now, you're clear about why someone doesn't like it. Let's go back to the example that started. You are playing your favorite game, the refresh rate is 75hz,100fps. You open the VSync. The game is limited to 75FPS, no problem, no tearing image, looks good. You get to a place where the images are particularly complex, when you don't have to VSync, your FPS drops to about 60. But you opened the vsync, your fps is actually just 37.5. So your game suddenly from 75FPS to 37.5FPS, no matter 37.5 is still very smooth but you will certainly notice that the refresh rate suddenly reduced by half. When the hypothesis is changed to 25FPS, the actual rate of reality may be just 17.5. The game that could have been played has become a slideshow. That's why people don't like it.


Assuming that your game's FPS is consistently larger than the display's refresh rate, VSync is a good thing to do. But suppose the FPS is large and small. VSync is the annoying thing. Assuming that your game FPS has been less than the refresh rate, the actual FPS is much smaller than the display card can display the FPS. It looks like VSync has reduced your FPS, but technically, it's not the image that's too complicated, but the way vsync works.
It's not that all hope is gone. Today's triple-buffering technology can be used to solve problems. Let's take another look at the refresh rate of 75. Examples of FPS50. The first frame in the display buffer, the second frame of 2/3 in the backing buffer. Display Refresh the first frame is shown, the remaining 1/3 of the second frame is depicted in the backup buffer, and the third frame's 1/3 is depicted in the second backup buffer (since we have a three-level buffer). The monitor refreshes the first frame the second time is shown, the second frame is placed in the display buffer, the third frame of the 1/3 into the backup buffer, the second backup buffer to depict the remaining 2/3 of the third frame. Then the display is refreshed again, the second frame is displayed, the third frames can be put into the display buffer, so that we can be 3 times in the refresh to get 2 frames of the screen. That is, 2/3 of the refresh rate, which means that 50fps.triple-buffering theoretically avoids the delay caused by buffer writes, so it doesn't waste time. But triple-buffering is not suitable for all games. In fact it is not universal (this article may be written too early, now triple-buffering is very popular), and it will also affect the performance of the display card, it needs a lot of other display memory, need a lot of other time in memory between the data copy to copy. But Triple-buffering is really a great way to eliminate tearing and not affect your fps like normal vsync.

I hope this article is practical and can help you understand how VSync works. (Especially if you don't hesitate to open the VSync) in short, assuming that there is no triple-buffering, how to weigh the vsync fps limit and eliminate the visual sensation of tearing the screen will depend entirely on your personal preferences.


The translator presses: Suppose the mechanism of this article is correct. Triple-buffering is not omnipotent, in fact, the reduction of 1/2 into a reduction of 1/3, assuming that the FPS happens to be stuck to a certain value when there is no problem, once not, That's absolutely a loss of FPS. So for a game that's just over 24 fps, whether it's triple-buffering or not, it should be off.


Why can't the refresh rate of the LCD monitor be adjusted high?


e-mail address for Lipi****[email protected] readers: I heard that the higher the display refresh frequency, the smaller the screen flicker, the damage to the eye is less, but my LCD display refresh rate is only 60Hz, Can't you turn it up to 75Hz or 85Hz like everyone else?

A: Here's a misunderstanding.



Originally we use CRT technology monitor, in order to ensure long time to look at the screen and eyes are not tired, we will generally adjust the refresh rate to 75H or even 85Hz, this is because of the characteristics of the CRT technology decision, the higher the refresh rate also means that the image is more clear, more stable. But for the LCD, because the LCD itself does not emit light, just the liquid crystal molecules to control the light deflection or through, the light is the backlight, that is, the fluorescent tube, in use even if the refresh rate to 60Hz you will not feel the screen flashing, "refresh rate" on the LCD has no much meaning, So in the use of liquid crystal display, we do not have to be too demanding the refresh rate of high and low.


What is VSync

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.