0
  1. https://unix.stackexchange.com/a/503874/674 says

    The display is effectively the X server; there is exactly one display per X server. So multiple X servers can’t run simultaneously on the same display, and an X server can’t run simultaneously on multiple displays. (Strictly speaking, the latter point isn’t correct, but I don’t think there’s an X server which can serve multiple displays.)

    https://www.x.org/archive/X11R6.8.0/doc/X.7.html#sect4 says a display can have multiple screens/monitors. $DISPLAY specifies a screen, not just a display, and is used in starting a X server or a X client. So does a X server start in a display or a screen? So does a X server start in a display or a screen?

  2. https://unix.stackexchange.com/a/503884/674 has a diagram that

    • distinguishes screen and monitor, while https://www.x.org/archive/X11R6.8.0/doc/X.7.html#sect4 seems to say they are the same concept when explaining screen number. Which one is correct?

    • shows a X server covers all the screens in a display. So does a display server start in a display or a screen or a monitor?

  3. Can I specify an arbitrary `$DISPLAY`? says:

    An xserver can use a hardware framebuffer, a dummy framebuffer (Xvfb) or a window on another xserver (Xephyr). The latter two are examples of "virtual" xserver/display

    Is a framebuffer associated with a display or a screen or a monitor?

Sorry I am still confused by the multiple concepts. Thanks.

Tim
  • 101,790

2 Answers2

3

So does a X server start in a display or a screen?

I’m not sure how to say this in a different way than I did previously; for all intents and purposes, the X server is a display (“display” as the X Window concept, which I understand is what we’re discussing here). An X server doesn’t start in a display, it is a display. You can think of this as “an X server starts a display”, and “a display contains one or more screens”.

The DISPLAY variable can be confusing since, as you say, it can specify more than the X display.

Which one is correct?

The diagram; see the explanation below.

Does a display server start in a display or a screen or a monitor?

In the X Window documentation, “display server” is synonymous with X server, so the above applies.

It may help to consider that the X Window documentation was written a long time ago, at a time when virtual displays weren’t used (much, if at all), and when multi-monitor setups were complex and often involved multiple X screens, and sometimes even multiple X servers. So in the X documentation, a screen is usually a monitor. However it quickly became obvious that it was annoying to split multiple monitors into multiple screens, and once graphics cards became capable of handling multiple monitors as a single unit, usage patterns changed so that X screens tended to cover multiple monitors.

Is a framebuffer associated with a display or a screen or a monitor?

“Framebuffer” is a somewhat nebulous term, with multiple definitions. In the context of the comment you’re quoting, it’s associated with a screen, and you can see this with Xvfb: if you tell it to use memory-mapped files for its framebuffers, and define multiple screens, you’ll see it use one framebuffer file per screen.

Stephen Kitt
  • 434,908
  • https://www.x.org/archive/X11R6.8.0/doc/X.7.html#sect4 says a display can have multiple screens/monitors. $DISPLAY specifies a screen, not just a display, and is used in starting a X server or a X client. So does a X server start in a display or a screen? So does a X server start in a display or a screen? – Tim Mar 13 '19 at 22:52
  • Thanks. I maybe wasn't clear about my first two questions. Now I updated my post, trying to be clearer. – Tim Mar 13 '19 at 22:56
  • Is that true your web browser doesn't render italic font at all? If so, does it render capitalized English letters? @Tim – 炸鱼薯条德里克 Mar 14 '19 at 00:24
  • @Tim, you’ve asked “So does a X server start in a display or a screen?” four times now (twice in your question, twice in your comment). What do you not find clear when I say “An X server doesn’t start in a display, it is a display.”? Your question is like asking if a crayon is in a pencil. – Stephen Kitt Mar 14 '19 at 06:34
  • @Tim assuming an Xserver with multiple "screens" (multiple monitors are nowadays managed as part of the same screen via xrandr): an application that successfully connected to a X11 server via DISPLAY=:0.1 is not forced to use just screen 1: the screen part of the display spec only determines what screen will be the default, ie what DefaultScreen(dpy) and DefaultScreenOfDisplay(dpy) will return. –  Mar 14 '19 at 07:42
  • @mosvy Thanks. (1) When a display has multiple screens, are the contents shown on the screens supposed to be different from each other, or can be always the same? (2) What is the purpose of the default screen of a display? (3) When a screen has multiple monitors, are the contents shown on the monitors supposed to be different from each other, or can always be the same? – Tim Mar 14 '19 at 17:18
  • @Tim have you ever used a system with multiple monitors? – Stephen Kitt Mar 14 '19 at 17:25
  • @StephenKitt (1) Are you talking about the case when a screen has multiple monitors? I saw two monitors are used together as if they were one, so they show different contents. But I am not sure if the two monitors for the same screen are always like that, or can always show the same content. (2) What about the case when a display has multiple screens? – Tim Mar 14 '19 at 18:15
  • X screens are handled independently, so they always show different contents (AFAIK). That’s their main disadvantage, it means you can’t (for example) drag a window from one screen to another, or show a window across two screens. Multiple monitors managed as a single screen (using XRandR) can show different content or identical content, it’s user-configurable. – Stephen Kitt Mar 14 '19 at 19:19
  • Thanks. Is a frame buffer associated with exactly one screen, and a screen exactly with a frame buffer? – Tim Mar 14 '19 at 19:44
  • See the last paragraph of my answer. You’ll have to be more specific about the context in which you’re talking about a framebuffer. – Stephen Kitt Mar 14 '19 at 20:01
  • My questions came from your last paragraph, especially "it’s associated with a screen" – Tim Mar 14 '19 at 20:03
  • Right, I need to expand that somewhat, I’ll take some time tomorrow. – Stephen Kitt Mar 14 '19 at 20:58
  • @Tim (1) they're supposed to be different (2) its purpose is to be returned by the DefaultScreen() X11 library function/macro. The concept of a "default" screen does not exist at X11 protocol level (3) if the X11 is managing all monitors as part of the same screen/root window, it's up to the user to configure them as they see fit via XRandR: make them overlapping, tiling the root window, apply transformations (eg. stretch when the monitor has non-rectangular pixels, keystone correction when the monitor is actually a projector, etc). There are gui frontends to XRandR (ARandR, LXRandr). –  Mar 15 '19 at 11:14
2

As you been told the 1000th time, the display IS the X server. So "X server run in a display" makes no sense.

X document use "display" to refer a bunch of hardware because in the old time, X servers usually(if not always) take control of and render to real hardware, but nowadays, many modern servers are able to run on and render to non-real(virtual) hardware-based target, e.g. Xephyr or Xvfb or Xorg with dummy video driver. The document don't get update very often, but it's not proper to say "A display is a bunch of hardware" on modern systems, it would be much better to say "A display is a running X server process".

An X server listens on an address(es), this address(es) can be connected using X11 protocol. How the X11 protocol data is transported is purely a platform specific thing, it could be a pair of TCP sockets, a TCP socket on the posix server side and a magic object on the non-posix client side(basically any two connected TCP endpoint), a pair of locally connected UDS(basically any two connected IPC endpoint, in which case X window system may become more powerful and efficient because the client and server run on the same machine, things like DRI becomes possible).

An X server might run multiple X screens(not to be confused with real-life monitors), and might handle multiple framebuffer (no matter real GPU framebuffer or malloc() buffer or mmap() disk-file memory space region), frambuffers doesn't have strict mapping with X screens, depends on your driver, settings, and which kind of X server you use.