Why does the screen momentarily turn black when plugging in a second monitor?

667 views

When a second monitor is plugged into a laptop, its screen turns black for a brief moment. Why does this happen?

See example: https://twitter.com/andrewculver/status/1334577349615095810?s=28

In: Technology

3 Answers

Anonymous 0 Comments

The way computer monitors work is that, many times per second (usually 30 or 60 times per second depending on your monitor, but sometimes even more), your computer calculates what should be displayed on the screen – calculates a color value for every pixel – and then updates the image on the screen based on that calculation. This is called a “screen refresh”. For example, imagine that you are running an application that has a button and a text box. During every refresh, your computer would go through a process something like the following (no need to actually pay attention to the math; it’s just an example):

* This text box is 200 pixels wide and 100 pixels tall, and is white
* This button is 20 pixels wide and 10 pixels tall, and is blue
* The text box is 20 pixels below from the top of the application window
* The text box is 20 pixels from the left of the application window
* Therefore, pixels (20, 20) up to (220, 220) inside of the application window need to be white
* The button is 20 pixels below the bottom of the text box, which is 220 pixels from the top of the application window
* The bottom is 20 pixels from the left of the application window
* Therefore, pixels (20, 240) up to (40, 250) inside of the application window need to be blue
* The application window itself is 100 pixels below the top of the screen
* The application window is 100 pixels from the left of the screen
* Therefore, pixels (120, 120) up to (320, 320) on the screen need to be white
* Therefore, pixels (120, 340) up to (140, 350) on the screen need to be blue

Of course, this is *vastly* oversimplified – in reality, there are much more complicated things being calculated, the results of some calculations can be reused across multiple screen refreshes without needing to be recalculated, etc. But this is the basic outline – every 30th or 60th of a second, calculate what color every pixel on the screen needs to be.

Have you ever been on a computer that is lagging for some reason, and the screen is sort of “jittery”? What’s happening there is that it’s taking longer for the computer to calculate what to draw on the screen than the allotted time budget (i.e., longer than a 30th or a 60th of a second), and so it’s updating the screen less frequently; if it updates infrequently enough, the illusion of motion is broken because your eye can see the individual steps, kind of like a really low frame rate movie.

When you plug in a new monitor, your computer has to do a *bunch* of calculations – *way* more than it would do during a normal screen refresh. This includes things like “should I move this window to the new monitor that just got plugged in?” and “do I need to change the screen resolution?” and other things that will affect what’s displayed on your old monitor. There’s no reason in principle that your computer couldn’t try to keep updating your old monitor while this is all being calculated, but if the programmers weren’t super careful, you’d end up with lots of weird effects that would be visually confusing (e.g., maybe first the resolution would change, and then later one window would disappear, and then even later a second window would disappear, and then even even later both of those windows would appear on the new monitor, etc). Since monitors getting plugged and unplugged happens relatively infrequently, it’s much simpler – and provides a cleaner experience for the user – to just blank everything out until all of the calculation is done.

For the same reason, your screen will go black when you make other big monitor changes like changing screen resolution.

You are viewing 1 out of 3 answers, click here to view all answers.