X Server Architecture
发布时间:2026-09-14 | 浏览:1
marchaesen/vcxsrv
Installation and Configuration
X Server Architecture
Windows Integration
Multiwindow Mode
Graphics Rendering Pipeline
2D Graphics (Pixman)
3D Graphics (OpenGL)
Direct Rendering Infrastructure (DRI)
Windows GLX Implementation
Mesa 3D Implementation
mhmake Build Tool
Makefile Structure
Protocol Implementation
X11 Protocol and XCB
fontconfig/Makefile.am
fontconfig/config-fixups.h
mesalib/src/gallium/auxiliary/util/u_blitter.c
mesalib/src/gallium/auxiliary/util/u_blitter.h
mesalib/src/gallium/auxiliary/util/u_tile.c
mesalib/src/mapi/glapi/gen/glX_proto_send.py
mesalib/src/mesa/main/dd.h
xorg-server/Xi/exevents.c
xorg-server/Xi/xiselectev.c
xorg-server/config/udev.c
xorg-server/damageext/makefile
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/getevents.c
xorg-server/dix/inpututils.c
xorg-server/dix/main.c
xorg-server/dix/touch.c
xorg-server/hw/xfree86/common/xf86Config.c
xorg-server/hw/xfree86/common/xf86Events.c
xorg-server/hw/xfree86/common/xf86Init.c
xorg-server/hw/xfree86/common/xf86Xinput.c
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/glx/simpledib.c
xorg-server/hw/xwin/makefile
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/winglobals.c
xorg-server/hw/xwin/winglobals.h
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsgwindow.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwndproc.c
xorg-server/hw/xwin/xdmcphostselect.c
xorg-server/include/input.h
xorg-server/include/inputstr.h
xorg-server/include/inpututils.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/resource.h
xorg-server/include/scrnintstr.h
xorg-server/include/xkbsrv.h
xorg-server/mi/mipointer.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/makefile
xorg-server/os/osdep.h
xorg-server/os/ospoll.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/test/input.c
xorg-server/test/signal-logging.c
xorg-server/test/xi2/xi2.c
xorg-server/xkb/xkbAccessX.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkb/xkbUtils.c
This page provides an overview of the VcXsrv X server architecture, focusing on the core components and how they interact. It explains the fundamental design principles behind the X Window System and how VcXsrv implements these principles on Windows.
For information about installation and configuration, see Installation and Configuration . For Windows-specific integration details, see Windows Integration .
Core X Server Architecture
The X server architecture follows a client-server model where applications (clients) connect to the X server to display their user interfaces. The X server manages the display, processes input, and handles communication with clients via the X protocol.
The architecture is divided into several layers:
Device Independent X (DIX) : Implements the core X protocol, handles client connections, manages resources, and routes requests to the appropriate handlers.
Device Independent X (DIX) : Implements the core X protocol, handles client connections, manages resources, and routes requests to the appropriate handlers.
Device Dependent X (DDX) : Provides platform-specific implementations of rendering and input operations. In VcXsrv, this layer interfaces with Windows.
Device Dependent X (DDX) : Provides platform-specific implementations of rendering and input operations. In VcXsrv, this layer interfaces with Windows.
Extension Layer : Provides additional functionality beyond the core X protocol, such as GLX for OpenGL support, RandR for screen resolution management, and XInput for extended input device support.
Extension Layer : Provides additional functionality beyond the core X protocol, such as GLX for OpenGL support, RandR for screen resolution management, and XInput for extended input device support.
Windows-Specific Implementation : Adapts the X server to run on Windows, including window management, input handling, and rendering.
Windows-Specific Implementation : Adapts the X server to run on Windows, including window management, input handling, and rendering.
xorg-server/hw/xwin/InitOutput.c 42-76
xorg-server/hw/xwin/win.h 97-146
xorg-server/dix/main.c 150-200
Server Initialization Process
The server initialization process starts with command-line parsing and proceeds through various initialization stages until the server is ready to accept client connections.
The initialization sequence:
Command-line Processing : Command-line arguments are parsed to determine server configuration.
Command-line Processing : Command-line arguments are parsed to determine server configuration.
OS Vendor Initialization : Windows-specific initialization is performed, including setting up paths and resources.
OS Vendor Initialization : Windows-specific initialization is performed, including setting up paths and resources.
Screen Initialization : One or more screens are initialized based on configuration.
Screen Initialization : One or more screens are initialized based on configuration.
Window Manager Initialization : For multi-window mode, a separate thread is started to handle window management.
Window Manager Initialization : For multi-window mode, a separate thread is started to handle window management.
Extension Initialization : X extensions are loaded and initialized.
Extension Initialization : X extensions are loaded and initialized.
Socket Initialization : Sockets are created to listen for client connections.
Socket Initialization : Sockets are created to listen for client connections.
Main Loop : The server enters its main event loop, waiting for client connections and input events.
Main Loop : The server enters its main event loop, waiting for client connections and input events.
xorg-server/hw/xwin/InitOutput.c 650-725
xorg-server/dix/main.c 248-325
xorg-server/hw/xwin/winprocarg.c 170-195
X Protocol and Events Architecture
The X server communicates with clients using the X protocol. Events are generated by the server and sent to clients, while requests are sent by clients to the server.
Key aspects of event handling:
Windows Message Translation : Windows messages (mouse, keyboard, window) are translated into X events.
Windows Message Translation : Windows messages (mouse, keyboard, window) are translated into X events.
Input Event Processing : Input events are processed and delivered to the appropriate clients based on grabs and window focus.
Input Event Processing : Input events are processed and delivered to the appropriate clients based on grabs and window focus.
Event Queue : Events are queued and dispatched to clients when they are ready to receive them.
Event Queue : Events are queued and dispatched to clients when they are ready to receive them.
Request Handling : Client requests are read from sockets, processed, and responses are sent back to clients.
Request Handling : Client requests are read from sockets, processed, and responses are sent back to clients.
Asynchronous I/O : The server uses asynchronous I/O to handle multiple clients efficiently.
Asynchronous I/O : The server uses asynchronous I/O to handle multiple clients efficiently.
xorg-server/dix/events.c 160-220
xorg-server/dix/dispatch.c 150-240
xorg-server/hw/xwin/winwndproc.c 150-200
xorg-server/os/WaitFor.c 150-220
Multi-Window Mode Architecture
VcXsrv's multi-window mode is one of its most important features, allowing X windows to appear as native Windows windows.
The multi-window architecture involves:
X-to-Windows Window Mapping : Each X window is mapped to a corresponding Windows window (HWND).
X-to-Windows Window Mapping : Each X window is mapped to a corresponding Windows window (HWND).
Window Manager Thread : A separate thread handles window management tasks such as window creation, destruction, and property updates.
Window Manager Thread : A separate thread handles window management tasks such as window creation, destruction, and property updates.
Event Translation : X events are translated to Windows messages and vice versa.
Event Translation : X events are translated to Windows messages and vice versa.
Window Properties : X window properties are reflected in the Windows window, including window title, icon, and size/position.
Window Properties : X window properties are reflected in the Windows window, including window title, icon, and size/position.
Window Procedures : Windows message procedures handle Windows messages and translate them to X events.
Window Procedures : Windows message procedures handle Windows messages and translate them to X events.
winCreateWindowsWindow() : Creates a Windows window for an X window
winDestroyWindowsWindow() : Destroys a Windows window when the X window is destroyed
winUpdateWindowsWindow() : Updates a Windows window when the X window changes
winMultiWindowWMProc() : Window manager thread procedure
xorg-server/hw/xwin/winmultiwindowwindow.c 50-150
xorg-server/hw/xwin/winmultiwindowwm.c 160-240
xorg-server/hw/xwin/winmultiwindowwndproc.c 490-570
Windows Event Integration
VcXsrv translates Windows events to X events and vice versa to integrate with the Windows environment.
The event integration process involves:
Window Procedures : Different window procedures handle messages for different types of windows: winTopLevelWindowProc() : For top-level (application) windows winWindowProc() : For the root window winMultiWindowXMsgProc() : For X protocol messages in multi-window mode
Window Procedures : Different window procedures handle messages for different types of windows:
winTopLevelWindowProc() : For top-level (application) windows
winWindowProc() : For the root window
winMultiWindowXMsgProc() : For X protocol messages in multi-window mode
Input Event Translation : Windows mouse messages are translated to X mouse events Windows keyboard messages are translated to X keyboard events Windows window messages are translated to X window events
Input Event Translation :
Windows mouse messages are translated to X mouse events
Windows keyboard messages are translated to X keyboard events
Windows window messages are translated to X window events
Event Propagation : Events are propagated through the X window hierarchy according to X protocol rules.
Event Propagation : Events are propagated through the X window hierarchy according to X protocol rules.
Focus Management : Window focus is managed between Windows and X to ensure proper input routing.
Focus Management : Window focus is managed between Windows and X to ensure proper input routing.
xorg-server/hw/xwin/winmultiwindowwndproc.c 490-900
xorg-server/hw/xwin/winwndproc.c 150-400
xorg-server/hw/xwin/winmultiwindowwm.c 1190-1240
xorg-server/hw/xwin/winkeybd.c 100-200
xorg-server/hw/xwin/winmouse.c 50-150
Graphics Rendering Architecture
VcXsrv supports multiple rendering modes to handle 2D and 3D graphics.
The rendering architecture consists of:
Drawing Modes : Shadow GDI: Uses a shadow framebuffer and GDI for rendering Shadow DirectDraw: Uses a shadow framebuffer and DirectDraw for rendering Native OpenGL: Uses WGL for OpenGL rendering
Drawing Modes :
Shadow GDI: Uses a shadow framebuffer and GDI for rendering
Shadow DirectDraw: Uses a shadow framebuffer and DirectDraw for rendering
Native OpenGL: Uses WGL for OpenGL rendering
Shadow Framebuffer : A memory buffer that contains the rendered image, which is then copied to the screen.
Shadow Framebuffer : A memory buffer that contains the rendered image, which is then copied to the screen.
Pixman : Provides 2D rendering operations such as compositing, filling, and image manipulation.
Pixman : Provides 2D rendering operations such as compositing, filling, and image manipulation.
OpenGL Support : GLX commands are translated to WGL (Windows OpenGL) commands for 3D rendering.
OpenGL Support : GLX commands are translated to WGL (Windows OpenGL) commands for 3D rendering.
Rendering Pipeline : X drawing commands are processed by the DIX layer Rendering is performed to the framebuffer The framebuffer is copied to the screen using Windows APIs
Rendering Pipeline :
X drawing commands are processed by the DIX layer
Rendering is performed to the framebuffer
The framebuffer is copied to the screen using Windows APIs
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/winshadddnl.c 150-250
xorg-server/hw/xwin/InitOutput.c 200-300
mesalib/src/gallium/auxiliary/util/u_blitter.c
Extension Architecture
VcXsrv supports various X extensions to provide additional functionality beyond the core X protocol.
Key extensions include:
GLX : Provides OpenGL rendering support. VcXsrv implements GLX using Windows OpenGL (WGL).
GLX : Provides OpenGL rendering support. VcXsrv implements GLX using Windows OpenGL (WGL).
RandR : Allows dynamic screen reconfiguration such as resolution changes and rotation.
RandR : Allows dynamic screen reconfiguration such as resolution changes and rotation.
XInput : Provides support for extended input devices beyond standard keyboard and mouse.
XInput : Provides support for extended input devices beyond standard keyboard and mouse.
XKB : Provides advanced keyboard handling including layouts, mappings, and modifiers.
XKB : Provides advanced keyboard handling including layouts, mappings, and modifiers.
Composite : Provides support for off-screen rendering and compositing, which enables effects like transparency.
Composite : Provides support for off-screen rendering and compositing, which enables effects like transparency.
The extension architecture:
Extension Registration : Extensions register their initialization functions with the server.
Extension Registration : Extensions register their initialization functions with the server.
Dispatch Tables : Each extension provides dispatch tables for handling its specific requests.
Dispatch Tables : Each extension provides dispatch tables for handling its specific requests.
Windows-Specific Implementation : Extensions like GLX have Windows-specific implementations.
Windows-Specific Implementation : Extensions like GLX have Windows-specific implementations.
xorg-server/hw/xwin/InitOutput.c 135-150
xorg-server/hw/xwin/win.h 150-180
xorg-server/hw/xwin/makefile 1-20
The VcXsrv X Server Architecture represents a complex adaptation of the X Window System to the Windows platform. By implementing the Device Dependent X (DDX) layer for Windows and providing sophisticated window management through the multi-window mode, VcXsrv enables X clients to run seamlessly on Windows environments.
Key architectural features that make this possible include:
The separation between device-independent (DIX) and device-dependent (DDX) code, allowing the core X server functionality to remain unchanged while platform-specific code handles Windows integration.
The separation between device-independent (DIX) and device-dependent (DDX) code, allowing the core X server functionality to remain unchanged while platform-specific code handles Windows integration.
The multi-window mode implementation that maps X windows to Windows windows, providing native look and feel.
The multi-window mode implementation that maps X windows to Windows windows, providing native look and feel.
Bidirectional event translation between Windows messages and X events.
Bidirectional event translation between Windows messages and X events.
Multiple rendering paths supporting both 2D (GDI, DirectDraw) and 3D (OpenGL via WGL) graphics.
Multiple rendering paths supporting both 2D (GDI, DirectDraw) and 3D (OpenGL via WGL) graphics.
Support for standard X extensions like GLX, RandR, and XInput, ensuring compatibility with a wide range of X applications.
Support for standard X extensions like GLX, RandR, and XInput, ensuring compatibility with a wide range of X applications.
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/win.h
xorg-server/dix/main.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwindow.c
Refresh this wiki
X Server Architecture
Core X Server Architecture
Server Initialization Process
X Protocol and Events Architecture
Multi-Window Mode Architecture
Windows Event Integration
Graphics Rendering Architecture
Extension Architecture