xcb-studies/xcb_read/Understanding_XRandr.md

2.7 KiB

Understanding XRandR

XRandR (X Rotate and Resize) controls the visible aspects of what is shown on a screen, but to do so it has a rather maddening collection of inter-related components that help it make sense of the X Server's responsbilities.

The purpose of the X Windows System is to display windows, rectangular regions on a human-visible display. In much the same way that every process on a computer is nested in a hierarchy of parents and children all the way up to the root process, in X every window is nested in a hierachy of parent and child windows and atomic components all the way up to the root window. The root window, in turn, belongs to a screen, which is the total addressable collection of pixels for which an X11 instance is responsible.

That screen and its window are typically singular-- the screen you see before you. But X11 is infinitely malleable. It is possible for X11 to have multiple screens, or to have a single screen that spans multiple monitors. And it is possible for X11 to drive those multiple monitors from one graphics card with multiple outputs, or from multiple graphics cards installed on the same computer.

The following objects need to be understood:

  • Server: The server that you'll be communicating with.
  • Connection: The connection your client has with that server.
  • Screen: A virtualized collection of pixels that the server is responsible for
  • CRCT: Cathode Ray Tube Controller, what we now call a 'graphics card', that the server uses to show a portion (possibly a portion as large as 100%) of the screen on a monitor.
  • Output: The physical connection between a CRTC and a monitor. Depending on the XRandR protocol and the modernity of the monitor, XRandR can probably extract information about the monitor from that monitor.

And the following facts:

  • A screen has both CRTCs and Outputs.
  • Although a CRTC can have an array of Outputs, at the moment each CRTC supports only one at a time. If a graphics card has multiple (phyisical) connectors, each connector has its own CRTC. As How Video Cards Work... [TK]
  • An output can have multiple CRTCs... but usually has only one.

Unresolved questions ...

  • If the output encapsulates the whole of screen (and the root window), when we rotate the output who does coordinate remapping? I believe that's the responsibility of the window manager. But if that's true, then what are the implications for image viewers?

  • If the output encapsulates only a subwindow of the whole, what is the responsibility of the window manager when the new dimensions fit easily within the screen as a whole?